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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 836 views
  • 2 likes
  • 3 in conversation