DATA Step, Macro, Functions and more

Data set dataset_:

Accepted Solution Solved
Reply
Contributor
Posts: 44
Accepted Solution

Data set dataset_:

I have a question about the function of "_:"

 

data all_claims;
	set  dataset1
		dataset2
		dataset3_:;

I don't see a dataset entitled "dataset3_:" elsewhere in the code, though I do something close to it. 

 

%macro dataset3 (year_start=, year=);
		data dataset3&YEAR. (where=(mdy(12,31,&YEAR_START.)<svcdate<=mdy(12,31,&YEAR.)));
			set have;
			rename date1=date2;
		run;
		
		proc means data=dataset3&YEAR. noprint nway missing;
			class var1 var2 var3;
			var var5 var6;
			output out=clean.dataset3_&YEAR. (drop=_:) sum=;
		run;
	%mend dataset3; 

Any idea what dataset3_: is in reference to? 


Accepted Solutions
Solution
‎10-27-2017 07:18 PM
Valued Guide
Posts: 570

Re: Data set dataset_:

What's important here is the colon after dataset3_ - that means all data sets starting with the name "dataset3_" like so

 

data dataset3_2015;
	set sashelp.class;
run;

data dataset3_2016;
	set sashelp.class;
run;

data dataset3_2017;
	set sashelp.class;
run;

data want;
	set dataset3_:;
	
run;

What you end up with it all three data sets appended

View solution in original post


All Replies
Solution
‎10-27-2017 07:18 PM
Valued Guide
Posts: 570

Re: Data set dataset_:

What's important here is the colon after dataset3_ - that means all data sets starting with the name "dataset3_" like so

 

data dataset3_2015;
	set sashelp.class;
run;

data dataset3_2016;
	set sashelp.class;
run;

data dataset3_2017;
	set sashelp.class;
run;

data want;
	set dataset3_:;
	
run;

What you end up with it all three data sets appended

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 1 reply
  • 230 views
  • 0 likes
  • 2 in conversation