DATA Step, Macro, Functions and more

This is the right way of starting program

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 7
Accepted Solution

This is the right way of starting program

 

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


Accepted Solutions
Solution
‎08-08-2016 04:14 PM
Super User
Posts: 19,817

Re: This is the right way of starting program

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


All Replies
Super User
Posts: 11,343

Re: This is the right way of starting program

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

Occasional Contributor
Posts: 7

Re: This is the right way of starting program

Thank you 

Solution
‎08-08-2016 04:14 PM
Super User
Posts: 19,817

Re: This is the right way of starting program

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. 

 

 

☑ This topic is solved.

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

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