<?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: need to change data in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/need-to-change-data/m-p/673971#M202859</link>
    <description>&lt;P&gt;Just trying to understand the concept in all ways. When I tried I was getting duplicates as in instead of 3 obs as output i was getting 6obs&lt;/P&gt;</description>
    <pubDate>Sun, 02 Aug 2020 03:33:11 GMT</pubDate>
    <dc:creator>helpmedoubts</dc:creator>
    <dc:date>2020-08-02T03:33:11Z</dc:date>
    <item>
      <title>need to change data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/need-to-change-data/m-p/673902#M202822</link>
      <description>&lt;P&gt;data have;&lt;BR /&gt;input fruit$ fru$ fco;&lt;BR /&gt;datalines;&lt;BR /&gt;banan f 10&lt;BR /&gt;broc v 14&lt;BR /&gt;apple f 15&lt;BR /&gt;;&lt;BR /&gt;run;&lt;BR /&gt;proc sort data = have; by fruit ;&lt;BR /&gt;proc transpose data = have out = fruit1;&lt;BR /&gt;by fruit ;&lt;BR /&gt;var fco ;&lt;BR /&gt;id fru ;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;now i need to transpose it back to get the original data as it was.&lt;/P&gt;</description>
      <pubDate>Sat, 01 Aug 2020 12:58:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/need-to-change-data/m-p/673902#M202822</guid>
      <dc:creator>helpmedoubts</dc:creator>
      <dc:date>2020-08-01T12:58:51Z</dc:date>
    </item>
    <item>
      <title>Re: need to change data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/need-to-change-data/m-p/673934#M202836</link>
      <description>&lt;P&gt;Here is a quick sample.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want(keep=fruit fru fco);
	set fruit1;
/* 	put sas variables into array */
	array tmp[2] _numeric_;
/* 	loop through array and put everything back into place */
	do i=1 to dim(tmp);
		fru=vlabel(tmp[i]);
		fco=tmp[i];
		if tmp[i] ne . then	output;
	end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 01 Aug 2020 16:03:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/need-to-change-data/m-p/673934#M202836</guid>
      <dc:creator>hhinohar</dc:creator>
      <dc:date>2020-08-01T16:03:27Z</dc:date>
    </item>
    <item>
      <title>Re: need to change data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/need-to-change-data/m-p/673935#M202837</link>
      <description>&lt;P&gt;Thank you. But i need the output using proc transpose only&lt;/P&gt;</description>
      <pubDate>Sat, 01 Aug 2020 16:09:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/need-to-change-data/m-p/673935#M202837</guid>
      <dc:creator>helpmedoubts</dc:creator>
      <dc:date>2020-08-01T16:09:26Z</dc:date>
    </item>
    <item>
      <title>Re: need to change data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/need-to-change-data/m-p/673959#M202852</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/339838"&gt;@helpmedoubts&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thank you. But i need the output using proc transpose only&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Sounds like an assignment problem. What have you tried already and where do you get stuck?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 02 Aug 2020 00:20:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/need-to-change-data/m-p/673959#M202852</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2020-08-02T00:20:52Z</dc:date>
    </item>
    <item>
      <title>Re: need to change data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/need-to-change-data/m-p/673968#M202857</link>
      <description>&lt;P&gt;Sorry for misreading the intention.&lt;/P&gt;&lt;P&gt;I tried a few option and I guess below is what is possible with proc transpose.&lt;BR /&gt;First I tried proc transpose with var and by option but that generated n*n obs with fruit and fco group&lt;BR /&gt;which led to outputting unnecessary missing observations.&lt;/P&gt;&lt;P&gt;So I added&amp;nbsp;where= data set option that omits missing&amp;nbsp;when outputting result data set&amp;nbsp;and that generated the desired output.&lt;/P&gt;&lt;P&gt;I hope this helps!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input fruit$ fru$ fco;
datalines;
banan f 10
broc v 14
apple f 15
;
run;
proc sort data = have; by fruit fru;
proc transpose data = have out = fruit1;
	by fruit ;
	var fco ;
	id fru ;
run;

/* omit missing with where= dataset option  */
/* as transpose will output missing obs with n*n merge (fruit fco)*/
proc transpose data = fruit1 out = want(rename=(_name_=fru) where=(fco ne .));
	var f v;
	by fruit;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 02 Aug 2020 02:56:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/need-to-change-data/m-p/673968#M202857</guid>
      <dc:creator>hhinohar</dc:creator>
      <dc:date>2020-08-02T02:56:37Z</dc:date>
    </item>
    <item>
      <title>Re: need to change data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/need-to-change-data/m-p/673971#M202859</link>
      <description>&lt;P&gt;Just trying to understand the concept in all ways. When I tried I was getting duplicates as in instead of 3 obs as output i was getting 6obs&lt;/P&gt;</description>
      <pubDate>Sun, 02 Aug 2020 03:33:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/need-to-change-data/m-p/673971#M202859</guid>
      <dc:creator>helpmedoubts</dc:creator>
      <dc:date>2020-08-02T03:33:11Z</dc:date>
    </item>
    <item>
      <title>Re: need to change data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/need-to-change-data/m-p/673972#M202860</link>
      <description>&lt;P&gt;Thank you. Both the programs worked. But i was looking for the second program(transpose). Sorry for the confusion. was getting duplicates in output, didn't think of using where option. Thanks again.&lt;/P&gt;</description>
      <pubDate>Sun, 02 Aug 2020 03:36:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/need-to-change-data/m-p/673972#M202860</guid>
      <dc:creator>helpmedoubts</dc:creator>
      <dc:date>2020-08-02T03:36:11Z</dc:date>
    </item>
    <item>
      <title>Re: need to change data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/need-to-change-data/m-p/674634#M203163</link>
      <description>&lt;P&gt;my pleasure.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Aug 2020 02:22:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/need-to-change-data/m-p/674634#M203163</guid>
      <dc:creator>hhinohar</dc:creator>
      <dc:date>2020-08-05T02:22:15Z</dc:date>
    </item>
  </channel>
</rss>

