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;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.