I have the following simple macro
%macro hospseq (DSN=,NDSN=);
data new2019; set &DSN; run; %YEARSTEP(YEAR =2019 );
proc datasets library=work nolist; change cake2_2019=&NDSN; quit; run;
proc export data=&NDSN outfile="s:\smm\excel\&ndsn" dbms=csv replace; run;
%mend hospseq;
When I run the macro using the parameters below it produces the output file MS2019_ALLcsv. What do I need to do to make the macro produce the CSV file with the CSV extension. So I get
MS2019_all.CSV instead of MS2019_allcsv . If I manually rename the file from MS2019_allCSV to MS2019_All.CSV the file is in the proper format. Thanks for any suggestions.
Larry
%HOSPSEQ(DSN=smm2019,NDSN=MS2019_All);
@Larry3Smith wrote:
I have the following simple macro
%macro hospseq (DSN=,NDSN=);
data new2019; set &DSN; run; %YEARSTEP(YEAR =2019 );
proc datasets library=work nolist; change cake2_2019=&NDSN; quit; run;
proc export data=&NDSN outfile="s:\smm\excel\&ndsn" dbms=csv replace; run;
%mend hospseq;
When I run the macro using the parameters below it produces the output file MS2019_ALLcsv. What do I need to do to make the macro produce the CSV file with the CSV extension. So I get
MS2019_all.CSV instead of MS2019_allcsv . If I manually rename the file from MS2019_allCSV to MS2019_All.CSV the file is in the proper format. Thanks for any suggestions.
Larry
%HOSPSEQ(DSN=smm2019,NDSN=MS2019_All);
Probably need to show us the code in that YEARSTEP macro as none of the code you show creates anything ending in CSV.
Somewhere you likely have a macro variable followed by .csv that needs to have ..csv.
Example:
%let var=ABC;
%put &var.csv;
%put &var..csv;
The macro language uses a single dot to indicate the end of the variable. So you need to have the second to be in the resolved value.
@Larry3Smith wrote:
I have the following simple macro
%macro hospseq (DSN=,NDSN=);
data new2019; set &DSN; run; %YEARSTEP(YEAR =2019 );
proc datasets library=work nolist; change cake2_2019=&NDSN; quit; run;
proc export data=&NDSN outfile="s:\smm\excel\&ndsn" dbms=csv replace; run;
%mend hospseq;
When I run the macro using the parameters below it produces the output file MS2019_ALLcsv. What do I need to do to make the macro produce the CSV file with the CSV extension. So I get
MS2019_all.CSV instead of MS2019_allcsv . If I manually rename the file from MS2019_allCSV to MS2019_All.CSV the file is in the proper format. Thanks for any suggestions.
Larry
%HOSPSEQ(DSN=smm2019,NDSN=MS2019_All);
Probably need to show us the code in that YEARSTEP macro as none of the code you show creates anything ending in CSV.
Somewhere you likely have a macro variable followed by .csv that needs to have ..csv.
Example:
%let var=ABC;
%put &var.csv;
%put &var..csv;
The macro language uses a single dot to indicate the end of the variable. So you need to have the second to be in the resolved value.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
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.
Ready to level-up your skills? Choose your own adventure.