Hello,
The source code of %ds2csv macro is stored in Application dispatcher.
In the following example, the %COPY statement writes the stored source code to the SAS log:
%macro foobar(arg) /store source
des="This macro does not do much";
%put arg = &arg;
%mend
%copy foobar/source;
What If I'm using the Utility macro %DS2CSV, for example
%ds2csv (data=sashelp.retail, runmode=b, csvfile=.\retail.csv);
When I tried using below, im facing the following error,
%copy ds2csv/source;
ERROR: /source option is not included in the macro ds2csv.
When I tried to find the source code of %ds2csv,
DS2CSV CSV File
Generator
webcsv1.sas,
webcsv1.html
This sample program uses the DS2CSV macro to convert
any SAS data set to a comma separated variable file to be
downloaded to the browser
You need to use %COPY to view the source code of a macro if the macro was delivered in a compiled catalog. But DS2CSV and other supplied SAS macro are delivered as source files.
So you don't need to se %COPY, just read the file.
data _null_;
infile sasautos('ds2csv.sas');
input;
put _infile_;
run;
There are different options when compiling a macro SAS(R) 9.4 Macro Language: Reference, Third Edition
Using "source" will store the source code with the compiled macro so it can easily be retrieved. On the other hand using "secure" will make it almost impossible for you to retrieve the source code.
Hi Patrick,
Thanks for the reply.
Alternatively, went through the SASROOT directory(Unix SAS 9.4). Under SASAUTOS, we have the ds2csv.sas code. Copied to my home directory, modified by adding "/store source" in %macro statement.
Thus, ERROR resolved.
Thanks,
Manohar
If you want this as a permanent solution for everybody then you could also extend the SASAUTOS paths with an additional directory (as first directory) and then store the amended copy of ds2csv.sas there. SAS will then pick-up this "overlay" version as it finds it first.
The disadvantage of such an approach is of course that this macro will never get updated when upgrading to a newer SAS version.
You need to use %COPY to view the source code of a macro if the macro was delivered in a compiled catalog. But DS2CSV and other supplied SAS macro are delivered as source files.
So you don't need to se %COPY, just read the file.
data _null_;
infile sasautos('ds2csv.sas');
input;
put _infile_;
run;
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.