BookmarkSubscribeRSS Feed
shivate_ps0
Calcite | Level 5

I am trying to understand how does following lines of code create a number of data sets. 

data _null_;
   if "&sysscp"="WIN" then do;
     call symputx('rawdata',"&path\"); 
	 end;
   else do;
     call symputx('rawdata',"&path/"); 
     end;
run;

And after these lines, obviously there many data sets written using SAS code including formats and lengths and so on. How does the above code generates complete data sets and puts them in a particular folder. Could anyone please tell me the whole process behind it ? How does these macro lines run at execution time.? 

  

	data library_name.a1;
   attrib Supplier_ID length=8 label='Supplier ID' format=12.;
   attrib Supplier_Name length=$30 label='Supplier Name';
   attrib Street_ID length=8 label='Street ID' format=12.;
   attrib Supplier_Address length=$45 label='Supplier Address';
   attrib Sup_Street_Number length=$8 label='Supplier Street Number';
   attrib Country length=$2 label='Country';

   infile datalines dsd;
   input
      Supplier_ID
      Supplier_Name
      Street_ID
      Supplier_Address
      Sup_Street_Number
      Country
   ;
datalines4;
50,Scandinavian Clothing A/S,6850100389,Kr. Augusts Gate 13,13,NO
109,Petterson AB,8500100286,Blasieholmstorg 1,1,SE
316,Prime Sports Ltd,9250103252,9 Carlisle Place,9,GB
755,Top Sports,3150108266,Jernbanegade 45,45,DK
772,AllSeasons Outdoor Clothing,9260115819,553 Cliffview Dr,553,US
798,Sportico,8300100454,C. Barquillo 1,1,ES
1280,British Sports Ltd,9250100844,85 Station Street,85,GB
1303,Eclipse Inc,9260107621,1218 Carriole Ct,1218,US
;;;;
run;

 

and many more data sets like this . But before doing all this following code must run successfully.

%let path=FILEPATH;
libname library_name "&path";
3 REPLIES 3
Astounding
PROC Star

It doesn't.  The top DATA step creates 0 data sets.

 

The bottom DATA step creates 1 data set.

 

Somewhere later in your program, you might see:

 

&rawdata

 

That could be the code you need explained.

shivate_ps0
Calcite | Level 5

Thanks but it does create .

These lines are to be run before to assign the library  either in SAS Studio or SAS Enterprise. 

 

%let path=FILEPATH;

libname library_name "&path";

 

Let me just edit my question.

 

 

Astounding
PROC Star

No, that code does not create data sets.  

 

It does, however, define what "orion" means as being a particular folder.  It is entirely possible that the folder already contains many SAS data sets, and executing the LIBNAME statement makes those existing data sets visible to your session.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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
  • 3 replies
  • 515 views
  • 0 likes
  • 2 in conversation