Given the results you describe (and given that you have tried to simplify the problem in order to share it) ...
Is it possible that the variable NAMES might contain a leading tab character, rather than a leading blank? I could imagine it's possible that a tab character within the program editor might be treated differently than a tab character brought in with %include.
COMPRESS function with the s modifier
http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000212246.htm
compress(name, , 'st')
That is really weird .
1) Try %left()
data serno_%left(&prod_grp);
set serials2_%left(&prod_grp);
eqp_id = trim(ser_no) || "CAT";
run;
2) Put prefix in when that macro variable is creating.
%do i = 1 %to &cnt;
data _null_;
set prod (obs = &i firstobs = &i);
call symputx ('prod_grp1', cats('serials2_',names));
call symputx ('prod_grp2', cats('serno_',names));
run;
%put "&prod_grp";
data &prod_grp2 ;
set &prod_grp1 ;
eqp_id = trim(ser_no) || "CAT";
run;
%end;
I tried your suggestions:
SYMBOLGEN: Macro variable NAME resolves to mttt 22: LINE and COLUMN cannot be determined. NOTE 242-205: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and COLUMN where the error has occurred. ERROR 22-7: Invalid option name DBCREATE_TABLE_OPTS. SYMBOLGEN: Macro variable NAME resolves to mttt ERROR: File WORK.SERNO_.DATA does not exist.
Number 2:
SYMBOLGEN: Macro variable PROD_GRP1 resolves to serials2_mttt "serials2_mttt" SYMBOLGEN: Macro variable PROD_GRP2 resolves to serno_mttt "serno_mttt" SYMBOLGEN: Macro variable PROD_GRP2 resolves to serno_mttt SYMBOLGEN: Macro variable PROD_GRP1 resolves to serials2_mttt ERROR: File WORK.SERIALS2_.DATA does not exist. ERROR: File WORK.MTTT.DATA does not exist.
@dwsmith Do you have this resolved or still having issues.
If you are, please post your full code and log.
Number2 looks good , It render the right value. But LOG said they don't exist there.
Check the WORK library ,and make sure they are being there .
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.