<?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: Generating percentages or ratios from two categorical variables in SAS in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Generating-percentages-or-ratios-from-two-categorical-variables/m-p/353864#M18461</link>
    <description>&lt;P&gt;Not sure if this solves your problem, but here's some code that dynamically divides all present years based on your previously stated criteria.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile cards missover;
length state $ 100 _2012 _2013 _2014 _2015 8.; 
input state _2012 _2013 _2014 _2015;
cards; 
Alabama 9653 10264 9557 11152
Alaska 6273 6476 6423 6576
Arizona 24199 21635 22835 20865
;
run;

PROC SQL;
CREATE TABLE ALLYEARS AS
SELECT MONOTONIC() AS ROWID, * FROM DICTIONARY.COLUMNS WHERE MEMNAME = 'HAVE' AND NAME LIKE '%20%';
QUIT;

PROC SQL;
SELECT TRIM(ALLYEARS.NAME) INTO: ALLNAMES SEPARATED BY "," FROM ALLYEARS ;
QUIT;

PROC SQL;
SELECT TRIM(ALLYEARS.NAME)||"/"||TRIM(ALLYEARS2.NAME)||" AS  "||TRIM(ALLYEARS.NAME)||"_"||TRIM(ALLYEARS2.NAME)||"  " 
INTO: ALLDIVS SEPARATED BY "," FROM ALLYEARS
, ALLYEARS AS ALLYEARS2
WHERE ALLYEARS.ROWID &amp;gt; ALLYEARS2.ROWID;
QUIT;

%PUT &amp;amp;ALLDIVS;

PROC SQL;
CREATE TABLE PROPORTION AS
SELECT state, &amp;amp;ALLNAMES, &amp;amp;ALLDIVS
FROM HAVE;
QUIT;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 26 Apr 2017 19:37:45 GMT</pubDate>
    <dc:creator>thomp7050</dc:creator>
    <dc:date>2017-04-26T19:37:45Z</dc:date>
    <item>
      <title>Generating percentages or ratios from two categorical variables in SAS</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Generating-percentages-or-ratios-from-two-categorical-variables/m-p/353356#M18431</link>
      <description>&lt;P&gt;I need to output percentages in SAS v9.4 that fall above a certain threshold from two categorical variables in a dataset - state and year. I first produced the following table that has all of the data:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; proc freq data=example;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; tables statefip * yr/ nopercent nocol norow missing out=test;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now I would like to calculate a percentage from year to year by state. There will be 10 years worth of data. For example, ratio1 = (Count of statefip variable from 2013)/(Count of statefip variable from 2012). If ratio1 is greater than a threshold (e.g., 80%), I would keep the data. If not, it would be coded as "missing".&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Is that possible to do in SAS?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In addition, is there a way to do this in a macro?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestions is greatly appreciated!&lt;/P&gt;</description>
      <pubDate>Tue, 25 Apr 2017 18:07:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Generating-percentages-or-ratios-from-two-categorical-variables/m-p/353356#M18431</guid>
      <dc:creator>tipscode</dc:creator>
      <dc:date>2017-04-25T18:07:19Z</dc:date>
    </item>
    <item>
      <title>Re: Generating percentages or ratios from two categorical variables in SAS</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Generating-percentages-or-ratios-from-two-categorical-variables/m-p/353359#M18432</link>
      <description>&lt;P&gt;Depending on how your data were structured:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;
CREATE TABLE PROPORTION AS
SELECT STATENAME, SUM(DISTINCT CASE WHEN STATEFLIP2013 = 1 THEN 1 ELSE 0 END)/SUM(DISTINCT CASE WHEN STATEFLIP2012 = 1 THEN 1 ELSE 0 END) 
FROM MYTABLE
GROUP BY STATENAME;
QUIT;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 Apr 2017 18:10:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Generating-percentages-or-ratios-from-two-categorical-variables/m-p/353359#M18432</guid>
      <dc:creator>thomp7050</dc:creator>
      <dc:date>2017-04-25T18:10:28Z</dc:date>
    </item>
    <item>
      <title>Re: Generating percentages or ratios from two categorical variables in SAS</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Generating-percentages-or-ratios-from-two-categorical-variables/m-p/353408#M18433</link>
      <description>&lt;P&gt;Apologies - I should have clarified with an illustrative table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I currently am using proc tabulate to generate the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;STATEFIP&lt;/TD&gt;&lt;TD&gt;2012&lt;/TD&gt;&lt;TD&gt;2013&lt;/TD&gt;&lt;TD&gt;2014&lt;/TD&gt;&lt;TD&gt;2015&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Alabama&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;9,653&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;10,264&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;9,557&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;11,152&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Alaska&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;6,273&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;6,476&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;6,423&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;6,576&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Arizona&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;24,199&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;21,635&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;22,835&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;20,865&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to generate the following table:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;STATEFIP&lt;/TD&gt;&lt;TD&gt;2012&lt;/TD&gt;&lt;TD&gt;2013&lt;/TD&gt;&lt;TD&gt;2014&lt;/TD&gt;&lt;TD&gt;2015&lt;/TD&gt;&lt;TD&gt;2013/2012&lt;/TD&gt;&lt;TD&gt;2014/2013&lt;/TD&gt;&lt;TD&gt;2015/2014&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Alabama&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;9,653&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;10,264&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;9,557&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;11,152&lt;/TD&gt;&lt;TD&gt;106.33%&lt;/TD&gt;&lt;TD&gt;93.11%&lt;/TD&gt;&lt;TD&gt;116.69%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Alaska&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;6,273&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;6,476&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;6,423&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;6,576&lt;/TD&gt;&lt;TD&gt;103.24%&lt;/TD&gt;&lt;TD&gt;99.18%&lt;/TD&gt;&lt;TD&gt;102.38%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Arizona&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;24,199&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;21,635&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;22,835&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;20,865&lt;/TD&gt;&lt;TD&gt;89.40%&lt;/TD&gt;&lt;TD&gt;105.55%&lt;/TD&gt;&lt;TD&gt;91.37%&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Tue, 25 Apr 2017 19:23:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Generating-percentages-or-ratios-from-two-categorical-variables/m-p/353408#M18433</guid>
      <dc:creator>tipscode</dc:creator>
      <dc:date>2017-04-25T19:23:54Z</dc:date>
    </item>
    <item>
      <title>Re: Generating percentages or ratios from two categorical variables in SAS</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Generating-percentages-or-ratios-from-two-categorical-variables/m-p/353413#M18434</link>
      <description>&lt;P&gt;Thanks for the specification!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My solution, for your review:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile cards missover;
length state $ 100 _2012 _2013 _2014 _2015 8.; 
input state _2012 _2013 _2014 _2015;
cards; 
Alabama 9653 10264 9557 11152
Alaska 6273 6476 6423 6576
Arizona 24199 21635 22835 20865
;
run;

PROC SQL;
CREATE TABLE PROPORTION AS
SELECT state, _2012, _2013, _2014, _2015
, _2013/_2012  "2013/2012" FORMAT 8.4 
, _2014/_2013  "2014/2013" FORMAT 8.4 
, _2015/_2014  "2015/2014" FORMAT 8.4 
FROM HAVE;
QUIT;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Patrick&lt;/P&gt;</description>
      <pubDate>Tue, 25 Apr 2017 19:30:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Generating-percentages-or-ratios-from-two-categorical-variables/m-p/353413#M18434</guid>
      <dc:creator>thomp7050</dc:creator>
      <dc:date>2017-04-25T19:30:13Z</dc:date>
    </item>
    <item>
      <title>Re: Generating percentages or ratios from two categorical variables in SAS</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Generating-percentages-or-ratios-from-two-categorical-variables/m-p/353441#M18435</link>
      <description>&lt;P&gt;The other option, if you want this dynamic would be to use PROC REPORT with a compute column.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PS. I'm moving this thread to reporting forum as it more pertains to reporting structure.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Apr 2017 20:27:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Generating-percentages-or-ratios-from-two-categorical-variables/m-p/353441#M18435</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-04-25T20:27:55Z</dc:date>
    </item>
    <item>
      <title>Re: Generating percentages or ratios from two categorical variables in SAS</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Generating-percentages-or-ratios-from-two-categorical-variables/m-p/353693#M18452</link>
      <description>&lt;P&gt;Thank you both for your timely suggestions!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to do this dynamically for future reports. Here is the code that I have thus far for your comments and suggestions:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;1) Creating a macro variable across years:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %LET CYR1 = %EVAL(2015); */For later iterations, one only have to update this year&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %LET CYR2 = %EVAL(&amp;amp;CYR1-1);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %LET CYR3 = %EVAL(&amp;amp;CYR1-2);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %LET CYR4 = %EVAL(&amp;amp;CYR1-3);&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2) I needed to concatenate and then subset two large datasets that will have new variables by the years:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DATA test;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SET dataset1 dataset2;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; state=stnamel(statefip);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF yr IN (&amp;amp;CYR1 &amp;amp;CYR2 &amp;amp;CYR3 &amp;amp;CYR4);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; YR1 = yr IN (&amp;amp;CYR1); */This creates counts per year, but I also see that it creates a binary variable where YR1 can be 0 or 1, I&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; need to figure out how to take out the values where YR1=0&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; YR2 = yr IN (&amp;amp;CYR2);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; YR3 = yr IN (&amp;amp;CYR3);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; YR4 = yr IN (&amp;amp;CYR4);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3) Right now I am thinking about using Proc Tabulate to calculate the proportions one column at a time. The code below is in dev because I need to figure out how to take out values where YR1=0, YR2=0, YR3=0, YR4=0. Can I use PCTN in the proc tabulate below? I don't think I can use PCTNSUM.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; PROC TABULATE DATA = test;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CLASS state;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; VAR YR3 YR4;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; TABLE state, YR3 YR4 YR3*PCTN&amp;lt;YR4&amp;gt;='Ratio 2013/2012'*f=8.2;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Where YR3='1' and YR4='1'; */Here is the logic but probably won't be a line of code&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to successfully execute 3), then set a conditional statement that if any ratio calculated, (e.g., ratio 2013/2012) is lt 70%, then drop the value or convert it to missing "."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you again.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Apr 2017 13:48:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Generating-percentages-or-ratios-from-two-categorical-variables/m-p/353693#M18452</guid>
      <dc:creator>tipscode</dc:creator>
      <dc:date>2017-04-26T13:48:44Z</dc:date>
    </item>
    <item>
      <title>Re: Generating percentages or ratios from two categorical variables in SAS</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Generating-percentages-or-ratios-from-two-categorical-variables/m-p/353807#M18457</link>
      <description>&lt;P&gt;I'm confused with the direction you're taking here.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why are you using macro variables? You should be designing this to not need the years in the data at all.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Apr 2017 17:38:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Generating-percentages-or-ratios-from-two-categorical-variables/m-p/353807#M18457</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-04-26T17:38:08Z</dc:date>
    </item>
    <item>
      <title>Re: Generating percentages or ratios from two categorical variables in SAS</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Generating-percentages-or-ratios-from-two-categorical-variables/m-p/353844#M18459</link>
      <description>&lt;P&gt;My main challenge has been to create counts of each year for the states, then generating new variables that has the proportion of the counts for states. So far I have not found a way to do this in a data step instead of a proc means/freq/tabulate.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Apr 2017 19:09:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Generating-percentages-or-ratios-from-two-categorical-variables/m-p/353844#M18459</guid>
      <dc:creator>tipscode</dc:creator>
      <dc:date>2017-04-26T19:09:09Z</dc:date>
    </item>
    <item>
      <title>Re: Generating percentages or ratios from two categorical variables in SAS</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Generating-percentages-or-ratios-from-two-categorical-variables/m-p/353855#M18460</link>
      <description>&lt;P&gt;What does your original data look like to start off with? So far you've only shown the aggregate data.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Apr 2017 19:26:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Generating-percentages-or-ratios-from-two-categorical-variables/m-p/353855#M18460</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-04-26T19:26:29Z</dc:date>
    </item>
    <item>
      <title>Re: Generating percentages or ratios from two categorical variables in SAS</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Generating-percentages-or-ratios-from-two-categorical-variables/m-p/353864#M18461</link>
      <description>&lt;P&gt;Not sure if this solves your problem, but here's some code that dynamically divides all present years based on your previously stated criteria.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile cards missover;
length state $ 100 _2012 _2013 _2014 _2015 8.; 
input state _2012 _2013 _2014 _2015;
cards; 
Alabama 9653 10264 9557 11152
Alaska 6273 6476 6423 6576
Arizona 24199 21635 22835 20865
;
run;

PROC SQL;
CREATE TABLE ALLYEARS AS
SELECT MONOTONIC() AS ROWID, * FROM DICTIONARY.COLUMNS WHERE MEMNAME = 'HAVE' AND NAME LIKE '%20%';
QUIT;

PROC SQL;
SELECT TRIM(ALLYEARS.NAME) INTO: ALLNAMES SEPARATED BY "," FROM ALLYEARS ;
QUIT;

PROC SQL;
SELECT TRIM(ALLYEARS.NAME)||"/"||TRIM(ALLYEARS2.NAME)||" AS  "||TRIM(ALLYEARS.NAME)||"_"||TRIM(ALLYEARS2.NAME)||"  " 
INTO: ALLDIVS SEPARATED BY "," FROM ALLYEARS
, ALLYEARS AS ALLYEARS2
WHERE ALLYEARS.ROWID &amp;gt; ALLYEARS2.ROWID;
QUIT;

%PUT &amp;amp;ALLDIVS;

PROC SQL;
CREATE TABLE PROPORTION AS
SELECT state, &amp;amp;ALLNAMES, &amp;amp;ALLDIVS
FROM HAVE;
QUIT;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 26 Apr 2017 19:37:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Generating-percentages-or-ratios-from-two-categorical-variables/m-p/353864#M18461</guid>
      <dc:creator>thomp7050</dc:creator>
      <dc:date>2017-04-26T19:37:45Z</dc:date>
    </item>
    <item>
      <title>Re: Generating percentages or ratios from two categorical variables in SAS</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Generating-percentages-or-ratios-from-two-categorical-variables/m-p/354062#M18466</link>
      <description>&lt;P&gt;Thank you so much! This works.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The original datasets have two variables, statefip (the full name of the US state that will be converted into abbreviated two letter states) as well as yr as a 8 digit numeric variable, with values including 2012, 2013, 2014, 2015.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is the data that can be derived from these original variable via proc freq:&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/8577i12258E220F22E144/image-size/original?v=1.0&amp;amp;px=-1" alt="Capture.PNG" title="Capture.PNG" border="0" /&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can proc sql follow an output dataset generated by proc tabulate to calculate the proportions without using cards?&amp;nbsp; Is this not possible because state is a character variable?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Probably not ideal, but I can also export this into Excel, calculate the proportions, and then import the Excel as a SAS dataset.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Apr 2017 11:58:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Generating-percentages-or-ratios-from-two-categorical-variables/m-p/354062#M18466</guid>
      <dc:creator>tipscode</dc:creator>
      <dc:date>2017-04-27T11:58:22Z</dc:date>
    </item>
    <item>
      <title>Re: Generating percentages or ratios from two categorical variables in SAS</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Generating-percentages-or-ratios-from-two-categorical-variables/m-p/354072#M18468</link>
      <description>&lt;P&gt;Cards and the first step is ONLY to generate a sample data set to work with. Replace HAVE with the name of your dataset.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Apr 2017 12:03:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Generating-percentages-or-ratios-from-two-categorical-variables/m-p/354072#M18468</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-04-27T12:03:37Z</dc:date>
    </item>
    <item>
      <title>Re: Generating percentages or ratios from two categorical variables in SAS</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Generating-percentages-or-ratios-from-two-categorical-variables/m-p/354106#M18469</link>
      <description>&lt;P&gt;Right, what Reeza said. &amp;nbsp;Regardless of how you process your initial dataset (e.g. proc freq, with/without ODS output saved, or calculating them using proc sql, import via excel, etc.) then you can run this procedure on your resulting dataset.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Apr 2017 13:30:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Generating-percentages-or-ratios-from-two-categorical-variables/m-p/354106#M18469</guid>
      <dc:creator>thomp7050</dc:creator>
      <dc:date>2017-04-27T13:30:05Z</dc:date>
    </item>
  </channel>
</rss>

