SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Toni2
Lapis Lazuli | Level 10

hi, the below macro is a part from a complex huge macro code. I have copied only the first part of the macro. (it is not complete)

 

What i don't understand is if the &prefix._continuous_bands_count_&i._&j.  dataset needs to pre-exist before i run the macro below or it is created by the macro? 

 

When i tried to run it i received an error that the dataset does not exist but i am not very sure if the macro creates empty dataset to be used later

 

 

%macro continuous_psi(prefix=,vars=,output=);
                                                                                                                  
	%let num_vars = %sysfunc(countw(%superq(vars)));

	%do i = 1 %to &num_vars.;

		%let var&i. = %qscan(%superq(vars), &i., %str( ));
		%put var&i. = &&var&i..;

		data &prefix._continuous_bands_count_&i.;
			set
%do j = 1 %to 6; &prefix._continuous_bands_count_&i._&j. (in = a&j.) %end; ;
%do j = 1 %to 6; if a&j. = 1 then band = &j.; %end; volume = max(0, volume); run;
1 ACCEPTED SOLUTION

Accepted Solutions
2 REPLIES 2
Toni2
Lapis Lazuli | Level 10
thank you

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

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
  • 690 views
  • 0 likes
  • 2 in conversation