data vehicles_info;
set sasuser.Vehicles.xlsx;
where make='Ford' and year='2015';
run;
proc print data=vehicles_info;
run;
With this program, I am trying to use an existing Sas table (sasuser.Vehicles.xlsx) to create a new table (vehicles_info) containing a subset of that original data. The second part of the program's goal is to generate a list report of the new table. When running the code, I've added a visual of the errors coming up in the SAS Studio log below. I have played around with the code in different ways such as omitting .xlsx from the set statement, editing the data set name, capitalizing M in make, using infile + path instead of set statement , nothing has worked. The above program, after all the tinkering, is the one with the least amount of errors. FYI - make variable is listed in the Excel table. Please assist with pointing out where I have gone wrong.
@GrizzlyDee wrote:
With this program, I am trying to use an existing Sas table (sasuser.Vehicles.xlsx) to create a new table (vehicles_info) containing a subset of that original data.
I don't believe that statement is correct. Please make sure you have correctly imported the Excel data set into SAS. There is a video recently posted on the SAS Analytics U page on how to import an Excel file. Once the file is imported correctly, you reference it with a two level name, LIBNAME.DATA_SET_NAME
If your dataset is called Vehicles, it would be:
data vehicles_info;
set sasuser.Vehicles;
where make='Ford' and year='2015';
run;
The other possibility is that you have validvarnames=ANY set, which means you would refer to the dataset as:
data vehicles_info;
set sasuser.'Vehicles.xlsx'n;
where make='Ford' and year='2015';
run;
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.
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.