BookmarkSubscribeRSS Feed
lakshmishree
Fluorite | Level 6

Hey all,

 

I tried importing excel file into SAS which has no variables declared and then i had renamed it into the variables and when i tried performing the following command to :

1. Prepare the dataset for input for a Discriminant analysis via SAS. 
2. Generate the means and the variance-covariance matrix of the data for the genuine note(Genuine = 1 and Fake =2 indicator column in the dataset).

Dataset contains six variables measured on 100 genuine and 100 forged (counterfeit/fake). 

 

 

proc import datafile = '/home/u49442084/sasuser.v94/Swiss Bank data as excel-2.xlsx'
out = SwissBank
dbms = xlsx
replace;
GETNAMES=NO;
run;


proc print data=SwissBank (rename=(a=length b=left c=right d=bottom e=top f=diag g=type));
run;

 

proc corr data=SwissBank cov;
Where type="1";
run;

 

 

when checking for genuine notes I got the following error:

 

1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
72
73 proc corr data=SwissBank cov;
74 Where type="1";
ERROR: Variable type is not on file WORK.SWISSBANK.
75 run;
2 REPLIES 2
PaigeMiller
Diamond | Level 26

You have not created a variable named TYPE in data set SwissBank, so when you run PROC CORR, SAS can't find it and writes an ERROR to the log.

 

Perhaps you mean this:

 

proc corr data=SwissBank (rename=(a=length b=left c=right d=bottom e=top f=diag g=type)) cov;
--
Paige Miller
lakshmishree
Fluorite | Level 6

Still getting the same error, variable type here is a categorical  datatype and if i am renaming it as type$ it throws an error there too. So i just had to convert it into CSV file and there it worked well

 

Thanks

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 833 views
  • 0 likes
  • 2 in conversation