Hi all,
I am having such a horrible time right now. I imported my own data set from excel from qualtrics and I am getting a bunch of error messages. I noticed that when I click on my data set sas7bdat format, I noticed there is character instead of numeric like the other data sets.
I am also getting ERROR: variable age in list does not match type prescribed for this list.
I am trying to run descriptive statistics on age, gender, and race.
I appreciate all your help so much!
this is my code
libname classdat "/home/u47052435/ClassDat";
proc contents data=group4homelessness;
run;
*Basic descriptive statistics for scale variable "age"
proc means data= classdat.group4homelessness
var age:
run;
*Additional statistics for scale "age";
proc means data=classdat.group4homelessness n mean median mode min max
stddev range qrange nmiss;
var age;
run;
How are you bringing in the Excel data? There are several ways this might occur:
Enterprise Guide might be the easiest, but all of these can be configured one way or another so that you can specify the data type when you import. I would delete the data and re-import unless there is an overriding reason not to do so.
You could also write a data step to convert things. It might be easier to just re-import the data though. Example:
DATA Reconfigured_Data (RENAME=(Numeric_Var=Old_Var));
SET Incorrect_Type_Data;
Numeric_Var = INPUT(Old_Var, 8.);
RUN;
The trick here is that 8. Informat. You have to get the right length for your data. Again, it might be easier to just re-import.
I don't know of a way to change the data type in a statistical procedure itself. You generally need to fix the data before running the Proc.
Jim
Hi Jim, I am adding the excel file through libname.
I tried generating the code you sent and I am getting ERROR: FILE WORK.INCORRECT_TYPE_DATA.DATA does not exist.
Yes, I just used that as an illustrative name. You have to change my code to the dataset names. The same applies to the variables. You have to substitute the real names for the names I used.
Jim
Looking at your code, the real dataset name I think is
classdat.group4homelessness
and the real variable name is
var age;
I was just trying to illustrate a principle. You still have to do a little work. 🙂
JIm
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!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: