<?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: Transformed table in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Transformed-table/m-p/905090#M357504</link>
    <description>Here is what I did.&lt;BR /&gt;ods exclude all;&lt;BR /&gt;proc freq data=MaTab;&lt;BR /&gt;  table Sexe *(a b c)/ nopercent nofreq nocol out=tab1 ;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;data tab1;&lt;BR /&gt;set tab1;&lt;BR /&gt;variable=compress("Sexe","'n'");;&lt;BR /&gt;Modalite=Sexe;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;From here, I want to create my table for the "Sex" variable.&lt;BR /&gt;I will do the same method for age. Then I'll concatenate to get my "Want" table.&lt;BR /&gt;My difficulty is to create the table "tab1_sum" which will look like this : &lt;BR /&gt;data tab1_sum;&lt;BR /&gt;   input Variable $ Modalite $ a $ b $ c $ ;&lt;BR /&gt;   datalines;&lt;BR /&gt;   Sexe F sum_of_pourcent(fort1,fort2,fort3)  sum_of_pourcent(fort1,fort2,fort3)  sum_of_pourcent(fort1,fort2,fort3) &lt;BR /&gt;   Sexe H sum_of_pourcent(fort1,fort2,fort3) sum_of_pourcent(fort1,fort2,fort3)  sum_of_pourcent(fort1,fort2,fort3)&lt;BR /&gt;   ;&lt;BR /&gt;   run;&lt;BR /&gt;Then this table "tab1_sum" will be concatenate for each variable in order to have my final table (want).&lt;BR /&gt;&lt;BR /&gt;Can someone help me please.&lt;BR /&gt;&lt;BR /&gt;THANKS&lt;BR /&gt;Gick</description>
    <pubDate>Wed, 29 Nov 2023 06:08:34 GMT</pubDate>
    <dc:creator>Gick</dc:creator>
    <dc:date>2023-11-29T06:08:34Z</dc:date>
    <item>
      <title>Transformed table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transformed-table/m-p/905086#M357500</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data MaTab;
   input Sexe $ age $ a $ b $ c $ ;
   datalines;
F [2-10] fort1 fort2 fort1
H [10-20] fort2 fort1 fort3
F [2-10] fort1 fort1 fort1
F [30-40] fort3 fort1 fort2
H [10-20] fort2 fort1 fort1
H [30-40] fort2 fort3 fort2
H [30-40] fort1 fort3 fort1
F [2-10] fort3 fort3 fort3
;
run; 


/*I would like to have a table like:*/
data want;
   input Variable $ Mod $ a $ b $ c $ ;
   datalines;
   Sexe F somme(fort1,fort2,fort3) somme(fort1,fort2,fort3) somme(fort1,fort2,fort3) 
   Sexe H somme(fort1,fort2,fort3) somme(fort1,fort2,fort3) somme(fort1,fort2,fort3)
   age [2-10] somme(fort1,fort2,fort3) somme(fort1,fort2,fort3) somme(fort1,fort2,fort3)
   age [10-20] somme(fort1,fort2,fort3) somme(fort1,fort2,fort3) somme(fort1,fort2,fort3)
   age [30-40] somme(fort1,fort2,fort3) somme(fort1,fort2,fort3) somme(fort1,fort2,fort3)
   ;
   run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Note that in the final "Want" table, the sum of the strong is the percentage sum of the crossing sex and a, sex and b, sex and c. I actually get the percentage to create this table. Same approach with age.&lt;/P&gt;
&lt;P&gt;Can someone suggest an approach or a program allowing me to have this table (want).&lt;/P&gt;
&lt;P&gt;Thanks for your help.&lt;/P&gt;
&lt;P&gt;Best regards,&lt;BR /&gt;Gick.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Nov 2023 05:37:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transformed-table/m-p/905086#M357500</guid>
      <dc:creator>Gick</dc:creator>
      <dc:date>2023-11-29T05:37:44Z</dc:date>
    </item>
    <item>
      <title>Re: Transformed table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transformed-table/m-p/905090#M357504</link>
      <description>Here is what I did.&lt;BR /&gt;ods exclude all;&lt;BR /&gt;proc freq data=MaTab;&lt;BR /&gt;  table Sexe *(a b c)/ nopercent nofreq nocol out=tab1 ;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;data tab1;&lt;BR /&gt;set tab1;&lt;BR /&gt;variable=compress("Sexe","'n'");;&lt;BR /&gt;Modalite=Sexe;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;From here, I want to create my table for the "Sex" variable.&lt;BR /&gt;I will do the same method for age. Then I'll concatenate to get my "Want" table.&lt;BR /&gt;My difficulty is to create the table "tab1_sum" which will look like this : &lt;BR /&gt;data tab1_sum;&lt;BR /&gt;   input Variable $ Modalite $ a $ b $ c $ ;&lt;BR /&gt;   datalines;&lt;BR /&gt;   Sexe F sum_of_pourcent(fort1,fort2,fort3)  sum_of_pourcent(fort1,fort2,fort3)  sum_of_pourcent(fort1,fort2,fort3) &lt;BR /&gt;   Sexe H sum_of_pourcent(fort1,fort2,fort3) sum_of_pourcent(fort1,fort2,fort3)  sum_of_pourcent(fort1,fort2,fort3)&lt;BR /&gt;   ;&lt;BR /&gt;   run;&lt;BR /&gt;Then this table "tab1_sum" will be concatenate for each variable in order to have my final table (want).&lt;BR /&gt;&lt;BR /&gt;Can someone help me please.&lt;BR /&gt;&lt;BR /&gt;THANKS&lt;BR /&gt;Gick</description>
      <pubDate>Wed, 29 Nov 2023 06:08:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transformed-table/m-p/905090#M357504</guid>
      <dc:creator>Gick</dc:creator>
      <dc:date>2023-11-29T06:08:34Z</dc:date>
    </item>
    <item>
      <title>Re: Transformed table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transformed-table/m-p/905163#M357523</link>
      <description>&lt;P&gt;You don't show any numbers in your expected output so it is impossible to tell what "percentage sum" you want to calculate.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also it looks like you have unique combinations for A, B and C so the counts of any frequency tables are going to be 1 in every combination so I am not sure what you intended to calculate.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Nov 2023 14:03:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transformed-table/m-p/905163#M357523</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-11-29T14:03:53Z</dc:date>
    </item>
  </channel>
</rss>

