BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
bondtk
Quartz | Level 8

Hi

 

I am new to SAS, i imported the excel file by using the Import wizard.

File has 8011 obsevations. I am using SAS studio and SAS EG as well.

 

Did the data segmentation uisng to capture data in different ranges.

Run Proc freq , which still shows 8011 observations.

Then run the proc summary to make this file as output so that I can export this file as excel file to run some pivot tables/chart.

Proc summary shows i have 5297 observations instead of 8011.  Not sure why? if someone can shed some light on it.

 

My code is:

 

data orion.aaamonthlydata;
length lend_level $10;
set orion.rawdatamonthly;

if amount_financed LE 75000 then Lend_Level ='Under75k';
else if (Amount_financed > 75000) and (Amount_financed<= 150000) then Lend_Level ='75-150k';
else if Amount_financed > 150000 and (Amount_financed<= 300000) then Lend_Level ='150k-300k';
else Lend_Level ='300k-500k';
run;

 

 

proc freq data=orion.aaamonthlydata order=freq;
tables lend_level*system_decision / norow nocol nopercent nocum;
title1 ' Volume Distribution ';
run;

 

Result: 8011 total observations in the table.

 

 


proc summary data=orion.aaamonthlydata nway missing;
class Amount_Financed System_decision lend_level;
output out=orion.volumedist;
run;

 

Only shows 5291 observations.

Need to know why proc freq shows 8011 observationa and proc summary shows 5297 observations. please advise.

 

1 ACCEPTED SOLUTION

Accepted Solutions
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Its quite hard to say without seeing data, but from your freq:

tables lend_level*system_decision / norow nocol nopercent nocum;

 

versus your summary:

class Amount_Financed System_decision lend_level;

 

We can see that there is another variable present - amount_financed which is not included in the freq.  Could it be that this is grouping the data in smaller groups, hence you end up with fewer results?

View solution in original post

3 REPLIES 3
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Its quite hard to say without seeing data, but from your freq:

tables lend_level*system_decision / norow nocol nopercent nocum;

 

versus your summary:

class Amount_Financed System_decision lend_level;

 

We can see that there is another variable present - amount_financed which is not included in the freq.  Could it be that this is grouping the data in smaller groups, hence you end up with fewer results?

bondtk
Quartz | Level 8

Hi

 

You are right, I though proc summary will show the same number of observations, but it grouped the entries and hence shows less observations, when I export the file in excel and run pivot table it shows the same 8011 as total , so the problem is solved.

ballardw
Super User

Your Proc Summary output shown is incomplete. Note that the output says 5 columns but you only show 3.

Yout output data set would contain two other variables if the code you show is what you ran. One variable would be _type_ to indicate the combination of class variables and the other would be _freq_ indicating how many records have that combination of the class variables.

So I suspect that _freq_ has occasional values of 2 or 3 or even more and the TOTAL of _freq_ will match the number of records from proc freq.

SAS Innovate 2025: Call for Content

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!

Submit your idea!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 3 replies
  • 1180 views
  • 2 likes
  • 3 in conversation