I'm currently getting the error message that says the file I'm trying to call in does not exist. As you can see from my screenshot, there is output.
However, in the screen print below it's stating that the variables do not exist. What am I doing wrong? I've never had this problem before.
As you can see, there are leading underlines in the variable names. This points to special characters being present in the spreadsheet. Use the names (not the labels!) as shown, or correct the header row in the spreadsheet before importing.
Run a PROC CONTENTS immediately after the PROC IMPORT to see the variable names.
Hint: set
options validvarname=v7;
before the import to avoid "iffy" names.
Or edit the first row of the spreadsheet before you import it.
My problem still remains. The variables are not populating in the output. Again, I've never had this problem.
Attached is the code I used:
Below is the output:
Then the code stops processing....
As you can see, there are leading underlines in the variable names. This points to special characters being present in the spreadsheet. Use the names (not the labels!) as shown, or correct the header row in the spreadsheet before importing.
For your last screenshot: Can you please run this code in a new SAS session with the import step you've got and then add:
proc contents data=work.bodyfat;
quit;
proc univariate data=bodyfat plot;
var age weight height;
run;
If the import step runs without errors and the proc contents lists variables age, weight and height then the proc plot just must work.
I tried your suggestion.
However, I still got the same error. The variables are not populating in the output.
You can see the problem in your screen shot.
Notice the horizontal position of the letter C in the variable 'Case Number'n .
Then notice that the first visible letter in the other variable names is slightly shifted to the right for the other variables.
Run PROC CONTENTS and create a DATASET with the variable names. Then use the NLITERAL() function to generate strings you can use to reference those strange variable names.
proc contents data=bodyfat out=contents; run;
data _null_;
set contents;
nliteral=nliteral(name);
put nliteral name=$quote. label=$quote.;
run;
Then copy and paste the name literal strings from the SAS log into your VAR statement.
I corrected the column headers in Excel, reloaded the file and now I'm good to GO!! Thanks!
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.