<?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: Transform multiple datasets from long to wide in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Transform-multiple-datasets-from-long-to-wide/m-p/827297#M326787</link>
    <description>&lt;P&gt;Since you are sending the results to non-SAS users, use PROC REPORT&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc report data=long;
column location percent,sex;
define location / group;
define percent / "" analysis;
define sex / "" across;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Use ODS to direct the output to the wanted file format. This combines the transpose and export into one step.&lt;/P&gt;</description>
    <pubDate>Fri, 05 Aug 2022 05:21:16 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2022-08-05T05:21:16Z</dc:date>
    <item>
      <title>Transform multiple datasets from long to wide</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transform-multiple-datasets-from-long-to-wide/m-p/827236#M326759</link>
      <description>&lt;P&gt;Is there a way to transform multiple datasets from long to wide without having to list out a transpose statement&amp;nbsp;&lt;/P&gt;
&lt;P&gt;for each dataset?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have multiple datasets that need to be transposed and as of now I have multiple transpose statements. For example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc transpose data = wide out = long prefix = gender_;&lt;BR /&gt;by location;&lt;BR /&gt;id sex ;&lt;BR /&gt;var percent ;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;proc transpose data = wide2 out = long2 prefix = age_;&lt;BR /&gt;by location;&lt;BR /&gt;id age;&lt;BR /&gt;var percent ;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;proc transpose data = wide3 out = long3 prefix = race;&lt;BR /&gt;by location;&lt;BR /&gt;id race;&lt;BR /&gt;var percent ;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anny assistance would be appreciated.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Aug 2022 21:19:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transform-multiple-datasets-from-long-to-wide/m-p/827236#M326759</guid>
      <dc:creator>luvscandy27</dc:creator>
      <dc:date>2022-08-04T21:19:44Z</dc:date>
    </item>
    <item>
      <title>Re: Transform multiple datasets from long to wide</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transform-multiple-datasets-from-long-to-wide/m-p/827239#M326761</link>
      <description>&lt;P&gt;Your data set names imply you want to make wide sets long. So which is it?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may consider describing what you have done to get to this point and why as the multiple data sets and the code shown smack of a very inefficient process overall.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Plus, if you are making wide sets from long, in spite of your data set names, the question might well be why? You would be creating multiple data sets that are difficult to work with. So what is it you plan to do with those multiple "wide" sets that requires them to be wide?&lt;/P&gt;</description>
      <pubDate>Thu, 04 Aug 2022 21:35:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transform-multiple-datasets-from-long-to-wide/m-p/827239#M326761</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-08-04T21:35:34Z</dc:date>
    </item>
    <item>
      <title>Re: Transform multiple datasets from long to wide</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transform-multiple-datasets-from-long-to-wide/m-p/827243#M326764</link>
      <description>I would like to make the long datasets wide. My apologies in the example I&lt;BR /&gt;entered them incorrectly.&lt;BR /&gt;&lt;BR /&gt;Nothing happens before this point these data are received wide and need to&lt;BR /&gt;be transposed since that's how it's always been.&lt;BR /&gt;&lt;BR /&gt;After they are transposed the datasets are sent to external stakeholders.&lt;BR /&gt;</description>
      <pubDate>Thu, 04 Aug 2022 21:45:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transform-multiple-datasets-from-long-to-wide/m-p/827243#M326764</guid>
      <dc:creator>luvscandy27</dc:creator>
      <dc:date>2022-08-04T21:45:45Z</dc:date>
    </item>
    <item>
      <title>Re: Transform multiple datasets from long to wide</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transform-multiple-datasets-from-long-to-wide/m-p/827249#M326766</link>
      <description>&lt;P&gt;Since the data set names are different and variables are different there's not much simplification. You could create a macro where you provide the parameters but it's not gaining you much IMO. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro flip(din = , dout = , var = );

proc transpose data= &amp;amp;din out= &amp;amp;dout prefix = &amp;amp;var._;
by location;
id &amp;amp;var.;
var percent;
run;

%mend;

%flip(din=wide, dout=long, var=gender);
%flip(din=wide2, dout=long2, var=age);
.....&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 04 Aug 2022 22:03:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transform-multiple-datasets-from-long-to-wide/m-p/827249#M326766</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-08-04T22:03:27Z</dc:date>
    </item>
    <item>
      <title>Re: Transform multiple datasets from long to wide</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transform-multiple-datasets-from-long-to-wide/m-p/827252#M326769</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/255656"&gt;@luvscandy27&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;I would like to&lt;FONT color="#800080"&gt;&lt;STRONG&gt; make the long datasets wide.&lt;/STRONG&gt; &lt;/FONT&gt;My apologies in the example I&lt;BR /&gt;entered them incorrectly.&lt;BR /&gt;&lt;BR /&gt;Nothing happens before this point these &lt;FONT color="#FF00FF"&gt;&lt;STRONG&gt;data are received wide&lt;/STRONG&gt; &lt;/FONT&gt;and need to&lt;BR /&gt;be transposed since that's how it's always been.&lt;BR /&gt;&lt;BR /&gt;After they are transposed the datasets are sent to external stakeholders.&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Am I the only one confused??? That appears to say "the data are received wide and we need to make it wide".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps a concrete example of a source file and the desired result are in order. Dummy values are fine as long as the source data resembles the structure of your current "received data set". Then show what the result should be.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hint: "How it's always been" does not mean it is not time to change as there are new tools all the time. Such as Paper and Pencil instead of Chisels and Stone.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Aug 2022 22:18:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transform-multiple-datasets-from-long-to-wide/m-p/827252#M326769</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-08-04T22:18:46Z</dc:date>
    </item>
    <item>
      <title>Re: Transform multiple datasets from long to wide</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transform-multiple-datasets-from-long-to-wide/m-p/827293#M326786</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/255656"&gt;@luvscandy27&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;Nothing happens before this point these data are received wide and need to&lt;BR /&gt;be transposed since that's how it's always been.&lt;BR /&gt;&lt;BR /&gt;...&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt; No,you are not the only one totally confused.&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/255656"&gt;@luvscandy27&lt;/a&gt; : Please post an example have dataset and the expected result. &lt;/P&gt;</description>
      <pubDate>Fri, 05 Aug 2022 04:49:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transform-multiple-datasets-from-long-to-wide/m-p/827293#M326786</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2022-08-05T04:49:02Z</dc:date>
    </item>
    <item>
      <title>Re: Transform multiple datasets from long to wide</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transform-multiple-datasets-from-long-to-wide/m-p/827297#M326787</link>
      <description>&lt;P&gt;Since you are sending the results to non-SAS users, use PROC REPORT&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc report data=long;
column location percent,sex;
define location / group;
define percent / "" analysis;
define sex / "" across;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Use ODS to direct the output to the wanted file format. This combines the transpose and export into one step.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Aug 2022 05:21:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transform-multiple-datasets-from-long-to-wide/m-p/827297#M326787</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-08-05T05:21:16Z</dc:date>
    </item>
  </channel>
</rss>

