BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Andrea_Bocco
Fluorite | Level 6

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.

1 ACCEPTED SOLUTION

Accepted Solutions
data_null__
Jade | Level 19
%let final_command="cat &foldin./*-&end. >> &out.";
%put NOTE: &=Final_command;

View solution in original post

2 REPLIES 2
data_null__
Jade | Level 19
%let final_command="cat &foldin./*-&end. >> &out.";
%put NOTE: &=Final_command;

Ready to join fellow brilliant minds for the SAS Hackathon?

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!
How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 894 views
  • 0 likes
  • 3 in conversation