Reading a subset from a SAS file using LIBNAME, data and set statement

sas

#1

Hi

I have a dataset which I need to subset from already sas7bdat file for manager. When I write a code for this using Libname to subset, it gives me an error “File name”". Not found.

Below is the code I wrote:

LIBNAME new1’'Path of the directory containing the file";
DATA one; ( created a temporary folder)
Set new1.filename;
if position=“MANAGER”;
Proc print;
run;


#2

Can you attach a screenshot of the error?


#3

Hi,

If you only want to subset the data. Do it like mentioned below -

libname new1 “Path”;
data one;
set new1.filename(where = (position = “MANAGER”));
run;

I don’t see any point in writing a proc print statement. Anyways writing a proc statement without specifying data is only going to throw error.

Hope this helps.

Regards,
Aayush


#4


#5

Hi Kunal,

I got the output for the code. Only mistake I did was not mentioning “” symbol at the end of the path before ;.
and altered the code as suggested by Aayushmnit.

Thanks,
Mohammed