[sas-users] Fw: frequency question

david.d.chapman at census.gov david.d.chapman at census.gov
Wed Jul 27 16:20:15 EDT 2011


Try This

Create Some Test Data 
                                                        data freq1;
                                                        do race1='b','w',
'h','?';
                                                        do i=1 to 100;
                                                                count=0;
                                                                if 
uniform(0)>.2 then count=1;
                                                                output ;
                                                                end;
                                                                end;
                                                        run;


                                                        data freq2;
                                                                do race2=
'b','w','h','?';
                                                                do i=1 to 
100;
 count=0;
                                                                        if 
uniform(0)>.2 then count=1;
                 output ;
                                                                end;
                                                                end;
                                                                run;

Find the frequencies from the first question.
The frequencies of the first question are in race1_freq and the second 
question in race2_freq.
There would be one dataset for each question.


        proc freq data=freq1;
                table race1/missing  out=race1_freq ;run;
 

        proc freq data=freq2;
                table race2/missing out=race2_freq;run;


Combine the datasets and rename the variable.

        data all_freq;
        set race1_freq(rename=(race1=race)) 
race2_freq(rename=(race2=race));
        run;

        proc print data=all_freq;run;


This will be you combined Frequency

        proc freq data=all_freq;
        table race/missing;run;
 

David D. Chapman
Chief, Quality Assurance Staff
Economic Planning and Coordination Division
U.S. Census Bureau - Economic Statistics
Office: 301-763-6535
Cell: 703-498-5782
E-mail: david.d.chapman at census.gov 

Connect with us:




From:
elizabeth.may.nichols at census.gov
To:
sas-users at lists.census.gov
Date:
07/27/2011 02:40 PM
Subject:
[sas-users] Fw: frequency question
Sent by:
sas-users-bounces at lists.census.gov




Thank you very much for getting me the right user group to ask this
question.    See below.

Beth Nichols
Center for Survey Measurement
U.S. Census Bureau
301-763-1724
elizabeth.may.nichols at census.gov

----- Forwarded by Elizabeth May Nichols/CSM/HQ/BOC on 07/27/2011 02:38 PM
-----
  
  From:       Elizabeth May Nichols/CSM/HQ/BOC   
  
  To:         Katherine Drom/CSM/HQ/BOC at BOC   
  
  Date:       07/27/2011 01:48 PM   
  
  Subject:    frequency question   
  




I have data that is from a mark all question.

Let's say it is race.
They stored the first answer as race1.  It could be between 1-6.  If the
person marked a second answer they stored the second answer as race 2.

race1 freq
white =5
black =4
asian =2

race 2 freq
white=1
black =1

I want a combined frequency.

race total
white=6
black=5
asian=2

I think I need to output my frequencies from the individual varialbes and
then add them together but I don't know how to do that.

I have a feeling it is a proc summary statement, but again, not sure and
have been playing round with it and haven't had luck.

Beth Nichols
Center for Survey Measurement
U.S. Census Bureau
301-763-1724
elizabeth.may.nichols at census.gov


_______________________________________________
sas-users mailing list
sas-users at lists.census.gov
http://lists.census.gov/mailman/listinfo/sas-users


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.census.gov/mailman/private/sas-users/attachments/20110727/e9204a14/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 4056 bytes
Desc: not available
URL: <http://lists.census.gov/mailman/private/sas-users/attachments/20110727/e9204a14/attachment-0001.jpe>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 660 bytes
Desc: not available
URL: <http://lists.census.gov/mailman/private/sas-users/attachments/20110727/e9204a14/attachment-0004.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 646 bytes
Desc: not available
URL: <http://lists.census.gov/mailman/private/sas-users/attachments/20110727/e9204a14/attachment-0005.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 1177 bytes
Desc: not available
URL: <http://lists.census.gov/mailman/private/sas-users/attachments/20110727/e9204a14/attachment-0006.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 654 bytes
Desc: not available
URL: <http://lists.census.gov/mailman/private/sas-users/attachments/20110727/e9204a14/attachment-0007.gif>


More information about the sas-users mailing list