<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How would i be able to represent these values in PROC FREQ if they are not in the data set? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-would-i-be-able-to-represent-these-values-in-PROC-FREQ-if/m-p/771323#M244738</link>
    <description>&lt;P&gt;You can use ODS OUTPUT to redirect the output to a dataset.&lt;/P&gt;</description>
    <pubDate>Thu, 30 Sep 2021 08:22:23 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2021-09-30T08:22:23Z</dc:date>
    <item>
      <title>How would i be able to represent these values in PROC FREQ if they are not in the data set?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-would-i-be-able-to-represent-these-values-in-PROC-FREQ-if/m-p/771289#M244716</link>
      <description>&lt;P&gt;Example: Do a cross tabulation of colorn*leveln?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Colorn is represented as follows:&amp;nbsp;&lt;/P&gt;&lt;P&gt;1- Red&lt;/P&gt;&lt;P&gt;2- Orange&lt;/P&gt;&lt;P&gt;3- Yellow&lt;/P&gt;&lt;P&gt;4-Green&lt;/P&gt;&lt;P&gt;5- Blue&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Leveln is represented as:&lt;/P&gt;&lt;P&gt;1-low&lt;/P&gt;&lt;P&gt;2-Medium&lt;/P&gt;&lt;P&gt;3-High&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the data set:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;obs colorn leveln

1&amp;nbsp; &amp;nbsp;1&amp;nbsp; 1

2   4  3

3   3 3&lt;/PRE&gt;&lt;P&gt;I have to make a table with counts that looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; low&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; med&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; high&lt;/P&gt;&lt;P&gt;red&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;x (xx.x)&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;x (xx.x)&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;x (xx.x)&lt;/P&gt;&lt;P&gt;orange&amp;nbsp;&amp;nbsp;x (xx.x)&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;x (xx.x)&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;x (xx.x)&lt;/P&gt;&lt;P&gt;yellow&amp;nbsp;&amp;nbsp;x (xx.x)&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;x (xx.x)&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;x (xx.x) &amp;nbsp;&lt;/P&gt;&lt;P&gt;green&amp;nbsp; &amp;nbsp; x (xx.x)&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;x (xx.x)&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;x (xx.x)&lt;/P&gt;&lt;P&gt;blue&amp;nbsp; &amp;nbsp;x (xx.x)&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;x (xx.x)&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;x (xx.x)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That means that there have to be zeros represented.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried using a proc freq with an out statement, but i'm not able to pull the cells with missing values. Is there a way to do that?&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried using this, but it doesn't work for what i'm trying to achieve.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data=data;
table colorn*leveln/ out=cnt;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Sep 2021 03:02:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-would-i-be-able-to-represent-these-values-in-PROC-FREQ-if/m-p/771289#M244716</guid>
      <dc:creator>Hello_there</dc:creator>
      <dc:date>2021-09-30T03:02:02Z</dc:date>
    </item>
    <item>
      <title>Re: How would i be able to represent these values in PROC FREQ if they are not in the data set?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-would-i-be-able-to-represent-these-values-in-PROC-FREQ-if/m-p/771298#M244719</link>
      <description>&lt;P&gt;So you don't want to produce that report you showed? Instead you just want to make a dataset?&lt;/P&gt;
&lt;P&gt;Why does it matter if the zeros are not in the dataset if you not making the report?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to make a report why not use PROC TABULATE so that you can use the PRELOADFMT option of the CLASS statement?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format ;
value color
  1= Red
  2= Orange
  3= Yellow
  4= Green
  5= Blue
;
value level
1=Low
2=Medium
3=High
;
run;

data have;
  input colorn leveln;
  format colorn color. leveln level.;
cards;
1 1
4 3
3 3
;

options missing='0';
proc tabulate data=have order=data;
  class colorn leveln /  preloadfmt ;
  tables colorn,leveln*(N PCTN) / printmiss ;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 326px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/64243iE6F0D2FBD30F304C/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Sep 2021 03:43:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-would-i-be-able-to-represent-these-values-in-PROC-FREQ-if/m-p/771298#M244719</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-09-30T03:43:14Z</dc:date>
    </item>
    <item>
      <title>Re: How would i be able to represent these values in PROC FREQ if they are not in the data set?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-would-i-be-able-to-represent-these-values-in-PROC-FREQ-if/m-p/771299#M244720</link>
      <description>Hi thanks for your reply. I need to make it a data set and not a report because what i'm working on is an on-going study that gets re-run constantly and i'm trying to make the data set according to a mock.</description>
      <pubDate>Thu, 30 Sep 2021 03:48:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-would-i-be-able-to-represent-these-values-in-PROC-FREQ-if/m-p/771299#M244720</guid>
      <dc:creator>Hello_there</dc:creator>
      <dc:date>2021-09-30T03:48:05Z</dc:date>
    </item>
    <item>
      <title>Re: How would i be able to represent these values in PROC FREQ if they are not in the data set?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-would-i-be-able-to-represent-these-values-in-PROC-FREQ-if/m-p/771300#M244721</link>
      <description>&lt;P&gt;One way is use a different procedure such as Proc Tabulate or Proc Report to do the summary using the Preloadfmt option where you create formats to display the text regardless of the presence of the value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Proc format;
value colorn
1 = 'Red'
2 = "Orange"
3 = "Yellow"
4 = "Green"
5 = "Blue"
;
value leveln
1 = "Low"
2 = "Medium"
3 = "High"
;
run;

data have;
 input colorn leveln;
datalines;
1 1
4 3
3 3
1 2
1 3
;

proc tabulate data=have;
   class colorn leveln / preloadfmt;
   format colorn colorn. leveln leveln.;
   table colorn=' ',
         leveln=' '*(n rowpctn)
         /printmiss misstext='0';
run;&lt;/PRE&gt;
&lt;P&gt;May get you started. You didn't show which goes in the () so I picked one of the percentages as an example.&lt;/P&gt;
&lt;P&gt;Preloadfmt requires use of other options such as Printmiss and/or order=data (on the class statement(s);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that there are some other potential data issues. Note the the data step creating Have data. That is how to display the data that you have (or want when you want a data set).&lt;/P&gt;</description>
      <pubDate>Thu, 30 Sep 2021 03:48:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-would-i-be-able-to-represent-these-values-in-PROC-FREQ-if/m-p/771300#M244721</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-09-30T03:48:25Z</dc:date>
    </item>
    <item>
      <title>Re: How would i be able to represent these values in PROC FREQ if they are not in the data set?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-would-i-be-able-to-represent-these-values-in-PROC-FREQ-if/m-p/771301#M244722</link>
      <description>&lt;P&gt;Hi thanks for your reply. I'm still a novice when it comes to programming, but does using PROC REPORT or TABULATE produce a sas data set?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Sep 2021 03:51:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-would-i-be-able-to-represent-these-values-in-PROC-FREQ-if/m-p/771301#M244722</guid>
      <dc:creator>Hello_there</dc:creator>
      <dc:date>2021-09-30T03:51:21Z</dc:date>
    </item>
    <item>
      <title>Re: How would i be able to represent these values in PROC FREQ if they are not in the data set?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-would-i-be-able-to-represent-these-values-in-PROC-FREQ-if/m-p/771312#M244730</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/252358"&gt;@Hello_there&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi thanks for your reply. I'm still a novice when it comes to programming, but does using PROC REPORT or TABULATE produce a sas data set?&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Both procedures can create datasets, unfortunately they won't be in the expected shape. Have a look at proc summary, the 6th example has all you need: &lt;A href="https://documentation.sas.com/doc/de/pgmsascdc/9.4_3.5/proc/n1eseaucwkzo18n1nph31op5kkdt.htm#n1eseaucwkzo18n1nph31op5kkdt" target="_blank" rel="noopener"&gt;https://documentation.sas.com/doc/de/pgmsascdc/9.4_3.5/proc/n1eseaucwkzo18n1nph31op5kkdt.htm#n1eseaucwkzo18n1nph31op5kkdt&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;EDIT: Well, except for not being able to create the data you want &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt; I should have read your post fully.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Sep 2021 06:12:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-would-i-be-able-to-represent-these-values-in-PROC-FREQ-if/m-p/771312#M244730</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2021-09-30T06:12:43Z</dc:date>
    </item>
    <item>
      <title>Re: How would i be able to represent these values in PROC FREQ if they are not in the data set?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-would-i-be-able-to-represent-these-values-in-PROC-FREQ-if/m-p/771323#M244738</link>
      <description>&lt;P&gt;You can use ODS OUTPUT to redirect the output to a dataset.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Sep 2021 08:22:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-would-i-be-able-to-represent-these-values-in-PROC-FREQ-if/m-p/771323#M244738</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-09-30T08:22:23Z</dc:date>
    </item>
    <item>
      <title>Re: How would i be able to represent these values in PROC FREQ if they are not in the data set?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-would-i-be-able-to-represent-these-values-in-PROC-FREQ-if/m-p/771328#M244749</link>
      <description>&lt;PRE&gt;data have;
  input colorn leveln;
  format colorn  leveln ;
cards;
1 1
4 3
3 3
;

data all;
do colorn=1 to 5;
 do leveln=1 to 3;
  output;
 end;
end;
run;

data want;
 set have(in=ina) all;
 w=ina;
run;

proc freq data=want;
table colorn*leveln/ out=cnt;
weight w/zero;
run;&lt;/PRE&gt;</description>
      <pubDate>Thu, 30 Sep 2021 09:52:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-would-i-be-able-to-represent-these-values-in-PROC-FREQ-if/m-p/771328#M244749</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-09-30T09:52:44Z</dc:date>
    </item>
    <item>
      <title>Re: How would i be able to represent these values in PROC FREQ if they are not in the data set?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-would-i-be-able-to-represent-these-values-in-PROC-FREQ-if/m-p/771438#M244815</link>
      <description>Thanks! PROC SUMMARY is exactly what i needed.</description>
      <pubDate>Thu, 30 Sep 2021 17:54:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-would-i-be-able-to-represent-these-values-in-PROC-FREQ-if/m-p/771438#M244815</guid>
      <dc:creator>Hello_there</dc:creator>
      <dc:date>2021-09-30T17:54:23Z</dc:date>
    </item>
  </channel>
</rss>

