BookmarkSubscribeRSS Feed
Astounding
PROC Star

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.

 

 

dwsmith
Obsidian | Level 7
@Astounding is there a way to strip tabs if this is the case?
Ksharp
Super User

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;

 

 

dwsmith
Obsidian | Level 7

@Ksharp

 

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.

 

Reeza
Super User

@dwsmith Do you have this resolved or still having issues. 

 

If you are, please post your full code and log. 

dwsmith
Obsidian | Level 7
@Reeza still have this issue.
Ksharp
Super User

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 .

dwsmith
Obsidian | Level 7
@Ksharp the datasets are there and nonempty. I can run this program without the %include call 100% no issues.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 23 replies
  • 2634 views
  • 2 likes
  • 5 in conversation