06-12-2017 12:24 AM
I am using an Excel file in SAS. I ran the following code and it worked.
PROC IMPORT OUT = ANALYSIS
DATAFILE="C:\Users\Arushi Arora\Documents\My SAS Files\slumdata.xlsx"
And then I sorted it by ID using the following code
PROC SORT DATA= ANALYSIS OUT= ANALYSIS1;
Since I only wanted to keep a few variables, i used the KEEP statement and the following code.
KEEP ID ZONE AGE GENDER;
But it didnt work. The LOG read the following:
WARNING: The variable ID in the DROP, KEEP, or RENAME list has never been referenced.
WARNING: The variable ZONE in the DROP, KEEP, or RENAME list has never been referenced.
WARNING: The variable AGE in the DROP, KEEP, or RENAME list has never been referenced.
WARNING: The variable GENDER in the DROP, KEEP, or RENAME list has never been referenced.
NOTE: The data set WORK.ANALYSIS1 has 1 observations and 0 variables.
I dont understand what this means! What code would be relevant to keep the following variables for my analysis?
And is it because this data was imported from an EXCEL file? Is there way to convert the Excel file to another format that can be easily read into SAS. I've used CSV and sas extension files before and never faced any issues.
06-12-2017 02:37 AM
I want to convert charac variables to numeric for analysis.
In my original dataset, I have gender mentioned as Male and Female and therefore i'm unable to use PROC MEANS or UNIVARIATE.
When i converted female=0 and male= 1 in the original data set, i was able to run these procedures. But it's cumbersome process since i have 90 other such variables that are in character form.
How can i convert charac into numeric form in SAS.
If i have to convert zones, for example- north, south, east and west to 0,1,2 and 3 respectively, what will the code look like?
Is there a way by which i can run Means or univariate or other such commands with the charac variables?
06-12-2017 02:45 AM
Please mark this question as answered by selecting the answers to your original question and start a new thread for your new question.
In general, see the following links to basic tutorials.
These specifially answer your latest question.
Need further help from the community? Please ask a new question.