BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
arun1234
Calcite | Level 5

 

libname wombat "/folders/myfolders/macro";

data wombat.orderdata;
infile "/folders/myfolders/macro/customer.sas7bdat";
input customer_ID;
set wombat.customer;
run;

 

what is the relevent of set varible here....or how can I use set with out infile oprion

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

SET - tells SAS this is the input data set you'll be working with. You reference a dataset as LIBNAME.DATASET_NAME. 

 

INFILE - tells SAS to read this file, used for text files, not SAS datasets (sas7bdat). SET and INFILE can be used together, but usually not at the beginning or while learning. 

 

INPUT - tells SAS what to read from the file, in this case it's saying read a single variable Customer_ID. 

 

Since you have a SAS dataset this isn't correct. Once you've assinged the library you can point to the dataset directly as someone else has pointed out. 

 

 

View solution in original post

3 REPLIES 3
ballardw
Super User

If the LIBNAME statement successfully assigns the library then

data wombat.orderdata;
   set wombat.customer;
run;

would create a copy of the customer data.

 

If you only want the customer id then add

 

keep customer_id;

 

Once the data is in a SAS data set (sas7bdat extension) then a library pointing to the location of the file and referencing the set as library.dataset is all that is needed. No Infile, no input needed

arun1234
Calcite | Level 5

Thank you 

Reeza
Super User

SET - tells SAS this is the input data set you'll be working with. You reference a dataset as LIBNAME.DATASET_NAME. 

 

INFILE - tells SAS to read this file, used for text files, not SAS datasets (sas7bdat). SET and INFILE can be used together, but usually not at the beginning or while learning. 

 

INPUT - tells SAS what to read from the file, in this case it's saying read a single variable Customer_ID. 

 

Since you have a SAS dataset this isn't correct. Once you've assinged the library you can point to the dataset directly as someone else has pointed out. 

 

 

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
  • 3 replies
  • 1009 views
  • 2 likes
  • 3 in conversation