10-14-2017 02:33 AM
I want to create a data set with following macro variable.
%let x =credit data;
Getting error, can not we remove the space within a macro variable by using some function?
10-14-2017 03:28 AM
You can remove the space like this (note that you need to remove the dot before _&sysdate9
%let x =credit data; data %sysfunc(compress(&x))_&sysdate9.; set sashelp.class; run;
10-14-2017 04:23 AM
DATA statement defines input dataset name in a format of <libref>.<DatasetName>.
LIBREF is defined by LIBNAME <libref> "path to data" and is limited to SAS names rules:
is a shortcut name or a "nickname" for the aggregate storage location where your SAS files are stored. It is any SAS name when you are assigning a new libref. When you are disassociating a libref from a SAS library or when you are listing attributes, specify a libref that was previously assigned.
|Range:||1 to 8 characters|
|Tip:||The association between a libref and a SAS library lasts only for the duration of the SAS session or until you change it or discontinue it with another LIBNAME statement.|
therefore, as compressed &x is 'CreditData' - 10 characters long, it will end with error - illegal libref name.
10-14-2017 05:31 AM - edited 10-14-2017 05:32 AM