03-04-2015 01:45 PM
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.
The following is the code:
LIBNAME new1''Path of the file'';
Kindly assist me.
03-04-2015 02:33 PM
You're going to have to do a lot of the work here. There's too much that you don't know and would need help with. Here are a few of the basics to get you started.
The path in a LIBNAME statement should be the path to a folder, not the path to a file. It's the folder where the SAS data set is stored (or alternatively where a new SAS data set is to be saved).
You only need one DATA statement, not two. The DATA statement names the data set being created, and the SET statement names the data set being read in. You will have to research how to use a two-part name to identify permanently saved data sets.
It's likely that you need quotes around 'manager'. Without quotes, the statement checks whether the variable named POSITION has the same value as the variable named MANAGER. Whenever something appears in quotes in SAS, spelling and capitalization is important.
03-04-2015 02:33 PM
Change the path, from path to the file, to the path of the directory containing the file
LIBNAME new1''Path to the directory containing the SAS file'';
WRONG => Libname new1 'c:\temp\sample.sas7bdat';
CORRECT=> Libname new1 'C:\temp\';
Also for filtering, the value needs to be in quotes and needs to match the case of the data or use a function such as upcase/lowcase to make them all the same.
WRONG =>position = manager
CORRECT => upcase(position) = 'MANAGER'
03-05-2015 06:40 AM
I did write a code as per your suggestions directing to the file path instead of file name. However, it still gives me an error stating the "Set new1.filename " not found.
Below is the code I wrote:
LIBNAME new1''Path of the directory containing the file";
DATA one; ( created a temporary folder)
It gives me an error