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;

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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