BookmarkSubscribeRSS Feed
xinjian
Calcite | Level 5

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

18 REPLIES 18
ballardw
Super User

Are you using weights or a freq variable?

Examples of code used might allow us more insight into possible issues.

xinjian
Calcite | Level 5

it is a simple categorical variable,  n=75, 3 classes. Results
showed Frequency missing =10.

The FREQ Procedure
flowblr1
flowblr1FrequencyPercentCumulativeCumulative
FrequencyPercent
borderline15201520
low9122432
normal516875100
Frequency
  Missing = 10

Reeza
Super User

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;

xinjian
Calcite | Level 5

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;

Reeza
Super User

Did you run the proc contents? Have you opened the data set to verify how many observations were imported?

xinjian
Calcite | Level 5


data set showed 75 subjects. it is really strange.

thanks

Reeza
Super User

Show the proc contents output?

stat_sas
Ammonite | Level 13

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;

xinjian
Calcite | Level 5

Thanks so much.

Reeza
Super User

That's not a good solution. You should make sure your data imports correctly instead and/or clean up the data before processing.

stat_sas
Ammonite | Level 13

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,

Reeza
Super User

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;

stat_sas
Ammonite | Level 13

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.

esjackso
Quartz | Level 8

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

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
  • 18 replies
  • 1355 views
  • 2 likes
  • 7 in conversation