- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I merged two datasets together using a common variable (occsoc); afterwards, a different variable (met2013) appears missing when I print the data but when I run a proc freq on the variable, it's all there like it is in the original set. Any ideas why it's doing this and also should I ignore it? (It is a variable I don't plan to use much if at all but would like it ready to go if need be).
In case this matters, one of the files (not the one containing met2013 variable) was once an Excel file that I imported into SAS and cleared of formats and informats before merging the two.
Thanks!
Diana
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Show us your code 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Data onetlib.onetipums;
merge IPUMS.ACS2016 onetlib.onetindexes;
by occsoc;
run;
proc print data=onetlib.onetipums (obs=10); run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
When there are more variables that can fit on the page width, proc print will split the printed table into many components. Could it be that the missing variable appeared on another page?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I should add, the original set was once sorted by met2013 and occsoc, then before the merge I sorted it by occsoc alone. Could sorting it in the past by met2013 have done something to cause this?
proc sort data=IPUMS.ACS2016; by met2013 occsoc; run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
From what you have shown us so far, it's still a guess. So here's an educated guess. Perhaps ....
The new data set being merged in contains some new values for OCCSOC, values that don't appear in the old data set. And, perhaps those values sort first. You are printing only ten observations. Those could represent mismatches from the merge step where if you looked a little further into the data you would start finding the matches and the valid values.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Is the variable of question in both your data sets?
Also, can you show us a part of your data? It is much easier to help you then..
PROC FREQ ignores missing values by default.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
no, it's only in acs2016 which I see in proc print also has missing met2013. But I think it's because I sorted it at one point with met2013 first, which probably lists first the missing observations then the rest.
SAS Output
Obs | MET2013 | PERNUM | PERWT | NCHILD | SEX | AGE | RACE | RACED | HISPAN | EMPSTAT | CLASSWKRD | OCCSOC | INDNAICS | INCWAGE | male | female | urban | noturban | yescitizen | nocitizen | citizenship | native | foreign | nativity | NOENGLISH | ENGLISH | SPKENG | NOHSDIPLOMA | HSDIPLOMA | SOMECOLLEGE | COLLEGE | GRADUATE | educa | MARRIED | NOTMARRIED | race4 | nativewhite | foreignwhite | nativeblack | foreignblack | nativeasian | foreignasian | nativehispanic | foreignhispanic | race8 | LowSkilled | HighSkilled | LowNative | LowForeign | HighNative | HighForeign | newforeign | estforeign | notmoved | moved | broad | major | minor | IND |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | . | 2 | 17.00 | 0 | 1 | 51 | 1 | 100 | 0 | 1 | 22 | 111021 | 3399ZM | 288519 | 1 | 0 | . | . | 1 | 0 | 1 | 1 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 0 | 0 | 1 | 5 | 1 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 5 |
2 | . | 1 | 50.00 | 0 | 1 | 32 | 2 | 200 | 0 | 1 | 22 | 111021 | 493 | 50177 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | 1 | 0 | 1 | 2 | 0 | 1 | 0 | 0 | 0 | 2 | 0 | 1 | 2 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 1 | 8 |
3 | . | 1 | 15.00 | 0 | 1 | 48 | 1 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1 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 0 | 1 | 0 | 4 | 1 | 0 | 3 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 5 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 1 | 6 |
8 | . | 1 | 6.00 | 0 | 1 | 33 | 1 | 100 | 0 | 1 | 22 | 111021 | 713Z | 83629 | 1 | 0 | . | . | 1 | 0 | 1 | 1 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 1 | 0 | 0 | 3 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 1 | 17 |
9 | . | 1 | 18.00 | 0 | 1 | 61 | 1 | 100 | 0 | 1 | 28 | 111021 | 2213M | 62722 | 1 | 0 | . | . | 1 | 0 | 1 | 1 | 0 | 1 | 0 | 1 | 2 | 0 | 1 | 0 | 0 | 0 | 2 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 3 |
10 | . | 2 | 70.00 | 0 | 1 | 24 | 1 | 100 | 0 | 1 | 22 | 111021 | 722Z | 28225 | 1 | 0 | 0 | 1 | 1 | 0 | 1 | 1 | 0 | 1 | 0 | 1 | 2 | 0 | 1 | 0 | 0 | 0 | 2 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 1 | 18 |
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Yes, missing values are considered by SAS as smaller than any other number.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
By default PROC FREQ will ignore the missing values add the MISSIING or MISSPRINT option to your TABLES statement.