We recommend
that you use a SAS Unicode server to process your data in order to
support multi-byte character set data that might appear in Web data.
If you
have existing jobs deployed that have not been running on a SAS Unicode
Application Server, the SAS tables created as output would have been
created using the encoding of the original SAS Application Server.
To make the most efficient use of a SAS server, you should store the
data in Unicode format with an encoding of UTF-8. By default, a file
inherits the current session encoding when it is created. One of your
first steps in converting an application to run with the SAS Unicode
server is to convert the legacy data files.
It might
be possible to run these jobs without converting the file encoding
of the SAS tables. However, this practice could result in poor performance
and a message similar to the following appearing in the SAS log:
Note: Data file PERMLIB.CH.DATA
is in a format that is native to another host, or the file encoding
does not match the session encoding. Cross Environment Data Access
will be used, which might require additional CPU resources and might
reduce performance.
A utility
macro has been provided to assist in the migration of the contents
of SAS Libraries within your job to your SAS Unicode Workspace Server.
We recommend that you back up all locations before you proceed with
any conversion in case a restore is necessary.
The SAS tables that
need to be converted depend on your template job. They can be found
in the following libraries:
-
-
-
Additional Output Library
-
Pre-assigned INLIB Library
The macro
below should be submitted on your SAS Unicode Application Server.
From within SAS Data Integration Studio, select your SAS Unicode Application
Server as the current SAS Application Server. Then, submit the following
macro with the
Code Editor under the Tools
menu:
%macro utf8conv(rootpath=);
%if %sysfunc(fileexist(&rootpath)) %then
%do;
libname root "&rootpath";
/* Grab list of tables in library. */
proc sql noprint;
select memname into :tables separated by ' '
from dictionary.members
where upcase(libname) eq 'ROOT' and
upcase(memtype) eq 'DATA';
quit;
%if &sqlobs gt 0 %then
%do;
/* Move tables to work */
proc datasets nowarn nolist;
copy out=work in=root move;
select &tables / mt=data;
quit;
/* Copy tables back to original location
with NOCLONE option, which will result
in the use of the current system encoding.
*/
proc datasets nowarn nolist;
copy out=root in=work noclone;
select &tables / mt=data;
quit;
/* Clean up work */
proc datasets lib=work nowarn nolist;
delete &tables / mt=data;
quit;
libname root clear;
%end;
%else %put No tables found in root location &rootpath
%end;
%else %put ERROR: Root path &rootpath not found.;
%mend;
The macro
can then be executed against each SAS library that contains SAS tables
that need to be converted. For example, to convert all of the SAS
tables that exist in the default locations for the Standard Web Log
Basic template job, you would submit the following:
%utf8conv(rootpath=%str(C:\ClickstreamTemplates\2.2\StandardWebLogs\Basic\Loop1\
Parse1));
%utf8conv(rootpath=%str(C:\ClickstreamTemplates\2.2\StandardWebLogs\Basic\Loop1\
Parse2));
%utf8conv(rootpath=%str(C:\ClickstreamTemplates\2.2\StandardWebLogs\Basic\Loop1\
Parse3));
%utf8conv(rootpath=%str(C:\ClickstreamTemplates\2.2\StandardWebLogs\Basic\Loop1\
Parse4));
%utf8conv(rootpath=%str(C:\ClickstreamTemplates\2.2\StandardWebLogs\Basic\Loop2\
Permlib1));
%utf8conv(rootpath=%str(C:\ClickstreamTemplates\2.2\StandardWebLogs\Basic\Loop2\
Permlib2));
%utf8conv(rootpath=%str(C:\ClickstreamTemplates\2.2\StandardWebLogs\Basic\Loop2\
Permlib3));
%utf8conv(rootpath=%str(C:\ClickstreamTemplates\2.2\StandardWebLogs\Basic\Loop2\
Permlib4));
%utf8conv(rootpath=%str(C:\ClickstreamTemplates\2.2\StandardWebLogs\Basic\Loop2\
Permlib5));
%utf8conv(rootpath=%str(C:\ClickstreamTemplates\2.2\StandardWebLogs\Basic\Loop2\
Sessionize1));
%utf8conv(rootpath=%str(C:\ClickstreamTemplates\2.2\StandardWebLogs\Basic\Loop2\
Sessionize2));
%utf8conv(rootpath=%str(C:\ClickstreamTemplates\2.2\StandardWebLogs\Basic\Loop2\
Sessionize3));
%utf8conv(rootpath=%str(C:\ClickstreamTemplates\2.2\StandardWebLogs\Basic\Loop2\
Sessionize4));
%utf8conv(rootpath=%str(C:\ClickstreamTemplates\2.2\StandardWebLogs\Basic\Loop2\
Sessionize5));
%utf8conv(rootpath=%str(C:\ClickstreamTemplates\2.2\StandardWebLogs\Basic\Output));
Once the
data is converted, it can be updated only in a UTF-8 session. Non-UTF-8
sessions can read the data but not write to the data.