BookmarkSubscribeRSS Feed
md11r0
Calcite | Level 5

The variables I have are Community, CommunityName, BirthRate, BelowPovLev, Crowded, Dependency, NoHSDiploma, Income, and Unemployment.

 

I have imported the CSV file, and with Proc Print, every variable shows up in the table. When I try to do any other procedure like sgscatter or corr, the variable Unemployment is not found. There are no spelling errors as I have copied and pasted the word from the Excel file. 

 

56 Proc sgscatter Data=Teen;
57 MATRIX Community BirthRate BelowPovLev Crowded Dependency NoHSDiploma Income
58 Unemployment;
ERROR: Variable UNEMPLOYMENT not found.
59 Run;
 
What am I doing wrong?
7 REPLIES 7
ChrisHemedinger
Community Manager

Best guess is that there is a subtle difference in the name that you're not noticing.  Try running 

 

 

proc contents data=teen; run;

 

 

and see what the output shows for the variable names.

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
md11r0
Calcite | Level 5

Is this what you're referring to? If so, what do I get from this table?


Screen Shot 2016-10-03 at 7.44.23 PM.png
ChrisHemedinger
Community Manager

Unemployment is a character variable, and I think it needs to be a numeric to be part of the MATRIX statement.  That's a misleading error message if that's the case, I'll admit.

 

If Unemployment is supposed be numeric, check your import step to ensure that variable is defined properly and read with a numeric informat.

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
md11r0
Calcite | Level 5

Okay. In the actual Excel file, everything under Unemployment is numeric. How would I get SAS to read it as numeric? I haven't worked much with Proc Import, sorry.

Reeza
Super User

When you import your CSV file check your log. The code will be in the log. Copy this code and customize as required by changing the informats/formats. 

RW9
Diamond | Level 26 RW9
Diamond | Level 26

If it is a CSV file, then write a datastep to read in the file exactly as you know the data to be.  Don't rely on proc import to guess things for you.

ballardw
Super User

Open the CSV file with something like NOTEPAD or WORDPAD, not Excel, and see if there are any quotes around the values you think should be numeric. Of if the first few rows of data are missing for the variable then Import may assume they are character if the Guessingrows wasn't set high enough (defaults to 20 I believe).

sas-innovate-2024.png

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.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 7 replies
  • 2396 views
  • 0 likes
  • 5 in conversation