I have more or less the following code:
/* previous operations to get macrovariable values for foldin, end and out */ %let final_command=cat &foldin./*-&end. >> &out.; %macro doit(command); filename p pipe "&command" lrecl=32767; data _null_; infile p; input; put _infile_; run; %mend; %doit(&final_command)
which, under a Linux environment, should paste together a few files named a-..., b-..., c-... and so on (where the dots reprents the same value that corresponds to &end) from the folder whose name is in foldin to a file named &out.
I've did a few test and the problem is clearly that I'm passing the character * as part of the macrovariable value. I've tried to use quoting functions, but I either don't mask him well enough and he gets read as a comment during macro execution, or I do it much and final_command isn't resolved properly.
Any idea how to solve it? I'm quite confused about quoting functions, so I would appreciate if someone can point out a very simple and easy to understand guide about them.
%let final_command="cat &foldin./*-&end. >> &out.";
%put NOTE: &=Final_command;
%let final_command="cat &foldin./*-&end. >> &out.";
%put NOTE: &=Final_command;
This might be one of the instances where it is better to have quotes in the macro variable.
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: