Help using Base SAS procedures

Strange proc freq resutls?

Accepted Solution Solved
Reply
Super Contributor
Posts: 338
Accepted Solution

Strange proc freq resutls?

Hi SAS Forum,

Scenario 1

I have imported a Access dataset (lets call Access_have_1) into SAS. Lets call the created SAS data set as have_1.

Then just stacked it with an existing sas dataset called have_2.

Then created want_1 sas dataset.

data want_1;

set have_1

      have_2;

run;

Scenario 2

I have first exported the same Access_have_1 dataset above as a CSV file.

Then read the CSV file into SAS and created the SAS data set named have_3.

Then stacked like below.

data want_2;

set have_3

      have_2; /*exisiting SAS dataset*/

run;

Question:

I got Want_1 and Want_2 files as identical two files.

However, when I ran proc freq for a variable called "Arrears_history" in both files one keeps giving strange

freq resutls.

Scenario 1 gives this table.

proc freq data =want_1;

tables arrears_band/list missing;

run;

Arrears_BandFrequency
1
1 - 3010
30 - 6025
60 - 905
1 - 3015
30 - 6015
60 - 908
90 +2
Current400
NPNA9

Scenario 2 gives this table.

proc freq data =want_2;

tables arrears_band/list missing;

run;

Arrears_BandFrequency
1
1 - 3025
30 - 6040
60 - 9013
90 +2
Current400
NPNA9

I keep trying several times still the same resutls are recurring.

You will see blue color and red color in the table under scenario 1 adds to meroon color figures in scenario 2 table.

Actually scenario 2 freq table is the correct one but how come scenario 1 table is strange.

Your help is appreciated.

Mirisage

(p.s. I cannot provide the data set as they are several thousands)


Accepted Solutions
Solution
‎04-30-2013 04:18 PM
Super User
Posts: 19,817

Re: Strange proc freq resutls?

It means your data isn't the exact same, even though it looks like it is, usually because of extra spaces.

Try running a compbl or trim function on the arrear_bands to remove any leading or trailing blanks and re-run the proc freq.

View solution in original post


All Replies
Super User
Posts: 11,343

Re: Strange proc freq resutls?

Run Proc Contents on have_1 and have_2. See if the properties for Arrears_band are different.

Solution
‎04-30-2013 04:18 PM
Super User
Posts: 19,817

Re: Strange proc freq resutls?

It means your data isn't the exact same, even though it looks like it is, usually because of extra spaces.

Try running a compbl or trim function on the arrear_bands to remove any leading or trailing blanks and re-run the proc freq.

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 179 views
  • 3 likes
  • 3 in conversation