roblem problemproc
I have a variable with 3 classes and n = 75. Proc means and proc freq all count n=85. What is the problem.
Thanks
Are you using weights or a freq variable?
Examples of code used might allow us more insight into possible issues.
it is a simple categorical variable, n=75, 3 classes. Results
showed Frequency missing =10.
The FREQ Procedure | ||||
flowblr1 | ||||
flowblr1 | Frequency | Percent | Cumulative | Cumulative |
Frequency | Percent | |||
borderline | 15 | 20 | 15 | 20 |
low | 9 | 12 | 24 | 32 |
normal | 51 | 68 | 75 | 100 |
Frequency Missing = 10 |
Can you show the code?
If you imported this from an Excel file, you may have accidentally imported some empty rows.
Run a proc contents on the dataset to see what shows up.
proc contents data=have;
run;
It is an excel file. Here is the code to access data sheet:
PROCIMPORT OUT=
WORK.BASELINE
DATAFILE="f:\V.xls"
DBMS=EXCEL REPLACE
SHEET="Sheet11$";
GETNAMES=YES;
MIXED=NO;
SCANTEXT=YES;
SEDATE=YES;
SCANTIME=YES;
RUN;
Did you run the proc contents? Have you opened the data set to verify how many observations were imported?
data set showed 75 subjects. it is really strange.
thanks
Show the proc contents output?
Try this and you will get the correct numbers. In excel file you deleted some of the data points (10) and these were imported as part of sas dataset.
proc freq data=have (where=(flowblr1 ne ' '));
table flowblr1;
run;
Thanks so much.
That's not a good solution. You should make sure your data imports correctly instead and/or clean up the data before processing.
Thanks for the input Reeza. That is true, data should be cleaned before processing. Could you please recommend some solution to exclude missing values while importing excel data into SAS or through some other method?
Regards,
Clean it up manually. The problem with the method below is that you may have valid missing obs, so you need to understand the data.
data clean_input;
set have;
if missing(flowblr1) then delete;
run;
Thanks Reeza - This works if we understand our data. But when we load data from other applications we are not sure about data structures and we may get missing values at the end of variable(s) which are hard to identify. So processing data after loading into SAS will make the life easier.
I know one way that I have found that works is to use excel libname engine (if you have it available). I can run the libname, see how sas is seeing the excel file, then use a data step to bring the file into sas with any cleaning done in the data step. In instances where missing is valid in all fields, I have wrote an array to check across all fields before deleting -- obviously a much bigger pain the larger the dataset.
libname in excel "\excelfile.xlsx";
data out;
drop f_20 - f_25; *blank column / field clean up;
set in."Sheet1"n;
if id = '' then delete; *row clean up -- works as long as id always suppose to have a value;
run;
libname in clear;
Just an added opinion!
EJ
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.