BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
annwashburn
Calcite | Level 5

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. 

annwashburn_1-1701234510985.png

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.

annwashburn_2-1701234630385.png   

 

annwashburn_3-1701234740082.png

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

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.

View solution in original post

9 REPLIES 9
Kurt_Bremser
Super User

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.

annwashburn
Calcite | Level 5

My problem still remains.  The variables are not populating in the output.  Again, I've never had this problem.  

annwashburn_0-1701244225463.png

 

annwashburn
Calcite | Level 5

Attached is the code I used:

annwashburn_0-1701244770399.png

Below is the output:

annwashburn_1-1701244903107.pngannwashburn_2-1701244932573.png

Then the code stops processing....

annwashburn_3-1701245126519.png

 

 

 

Kurt_Bremser
Super User

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.

Patrick
Opal | Level 21

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. 

annwashburn
Calcite | Level 5

I tried your suggestion.

annwashburn_0-1701243639222.png

However, I still got the same error. The variables are not populating in the output.

annwashburn_1-1701243689614.png

 

 

Tom
Super User Tom
Super User

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.

annwashburn
Calcite | Level 5

I corrected the column headers in Excel, reloaded the file and now I'm good to GO!!   Thanks!

annwashburn_0-1701305157531.png

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
Mastering the WHERE Clause in PROC SQL

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.

Discussion stats
  • 9 replies
  • 1189 views
  • 1 like
  • 4 in conversation