<?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: adjusting the data based on their rows. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/adjusting-the-data-based-on-their-rows/m-p/806342#M317674</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;I have a dataset that has more than 100 line. is there a quick way to keep only the first 6 rows and delete the rest.
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Data want;
   set have (obs=6);
run;&lt;/PRE&gt;
&lt;P&gt;creates a new data set Want with the first 6 observations from Have.&lt;/P&gt;
&lt;P&gt;The data set option OBS can be used anywhere you are specifying the set to use. So&lt;/P&gt;
&lt;PRE&gt;Proc print data=have (obs=6);
run;&lt;/PRE&gt;
&lt;P&gt;only prints the first 6 observations without removing any. This will work for input into any procedure.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is also a FIRSTOBS= data set option ;&lt;/P&gt;
&lt;PRE&gt;Data want; 
   set have (firstobs=7);
run;&lt;/PRE&gt;
&lt;P&gt;which would create a new data set starting with the 7th observation in Have.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 06 Apr 2022 16:36:42 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2022-04-06T16:36:42Z</dc:date>
    <item>
      <title>adjusting the data based on their rows.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/adjusting-the-data-based-on-their-rows/m-p/806339#M317671</link>
      <description>&lt;P&gt;I have a data that I'm trying to adjust based on the row number, or say row name,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;say I have the data below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data mydata;&lt;BR /&gt;input indix $ prod1-prod6;&lt;BR /&gt;cards;&lt;BR /&gt;ind1 0.4 5 2 3 11 13&lt;BR /&gt;ind2 1 7 10 20 15 25&lt;BR /&gt;ind3 4 2 6 10 13 24&lt;BR /&gt;ind4 5 6 15 27 31 22&lt;BR /&gt;ind5 18 1 28 38 11 12&lt;BR /&gt;ind6 18 1 22 39 13 12&lt;BR /&gt;ind7 10 2 19 40 10 11&lt;BR /&gt;ind8 11 9 40 70 2 10&lt;BR /&gt;;&lt;BR /&gt;run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Abdulla1_0-1649261367588.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/70171iCC710C48AAC0CDD8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Abdulla1_0-1649261367588.png" alt="Abdulla1_0-1649261367588.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to drop the prod# if it has ind5 and ind6 identical. (which will drop prod1 prod2 and Prod6)&lt;/P&gt;
&lt;P&gt;moreover, I have a dataset that has more than 100 line. is there a quick way to keep only the first 6 rows and delete the rest.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Apr 2022 16:25:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/adjusting-the-data-based-on-their-rows/m-p/806339#M317671</guid>
      <dc:creator>Abdulla1</dc:creator>
      <dc:date>2022-04-06T16:25:37Z</dc:date>
    </item>
    <item>
      <title>Re: adjusting the data based on their rows.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/adjusting-the-data-based-on-their-rows/m-p/806340#M317672</link>
      <description>I'm not sure why the code appeared in this way. please find the data code below:&lt;BR /&gt;data mydata;&lt;BR /&gt;input indix $ prod1-prod6;&lt;BR /&gt;cards;&lt;BR /&gt;ind1 0.4 	5	 2 	3 	11	13&lt;BR /&gt;ind2 1 		7 	10 	20 	15 	25&lt;BR /&gt;ind3 4	 	2	 6	10 	13 	24&lt;BR /&gt;ind4 5		6	15	27	31	22&lt;BR /&gt;ind5 18		1	28	38	11	12&lt;BR /&gt;ind6 18		1	22	39	13	12&lt;BR /&gt;ind7 10		2	19	40	10	11&lt;BR /&gt;ind8 11		9	40	70	2	10&lt;BR /&gt;;&lt;BR /&gt;run;&lt;BR /&gt;</description>
      <pubDate>Wed, 06 Apr 2022 16:26:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/adjusting-the-data-based-on-their-rows/m-p/806340#M317672</guid>
      <dc:creator>Abdulla1</dc:creator>
      <dc:date>2022-04-06T16:26:38Z</dc:date>
    </item>
    <item>
      <title>Re: adjusting the data based on their rows.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/adjusting-the-data-based-on-their-rows/m-p/806342#M317674</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;I have a dataset that has more than 100 line. is there a quick way to keep only the first 6 rows and delete the rest.
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Data want;
   set have (obs=6);
run;&lt;/PRE&gt;
&lt;P&gt;creates a new data set Want with the first 6 observations from Have.&lt;/P&gt;
&lt;P&gt;The data set option OBS can be used anywhere you are specifying the set to use. So&lt;/P&gt;
&lt;PRE&gt;Proc print data=have (obs=6);
run;&lt;/PRE&gt;
&lt;P&gt;only prints the first 6 observations without removing any. This will work for input into any procedure.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is also a FIRSTOBS= data set option ;&lt;/P&gt;
&lt;PRE&gt;Data want; 
   set have (firstobs=7);
run;&lt;/PRE&gt;
&lt;P&gt;which would create a new data set starting with the 7th observation in Have.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Apr 2022 16:36:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/adjusting-the-data-based-on-their-rows/m-p/806342#M317674</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-04-06T16:36:42Z</dc:date>
    </item>
    <item>
      <title>Re: adjusting the data based on their rows.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/adjusting-the-data-based-on-their-rows/m-p/806767#M317929</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/414636"&gt;@Abdulla1&lt;/a&gt;&amp;nbsp;wrote:
&lt;P&gt;I want to drop the prod# if it has ind5 and ind6 identical. (which will drop prod1 prod2 and Prod6)&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I figured out the following way of doing it.&lt;/P&gt;
&lt;P&gt;data mydata;&lt;BR /&gt;input indix $ prod1-prod6;&lt;BR /&gt;cards;&lt;BR /&gt;ind1 0.4 5 2 3 11 13&lt;BR /&gt;ind2 1 7 10 20 15 25&lt;BR /&gt;ind3 4 2 6 10 13 24&lt;BR /&gt;ind4 5 6 15 27 31 22&lt;BR /&gt;ind5 18 1 28 38 11 12&lt;BR /&gt;ind6 18 1 22 39 13 12&lt;BR /&gt;ind7 10 2 19 40 10 11&lt;BR /&gt;ind8 11 9 40 70 2 10&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;proc transpose data=mydata(RENAME=(indix=_NAME_)) out=TEMPDATA1;run;&lt;BR /&gt;data TEMPDATA2;&lt;BR /&gt;set TEMPDATA1;&lt;BR /&gt;if ind5=ind6 THEN DELETE;&lt;BR /&gt;RUN;&lt;BR /&gt;proc transpose data=TEMPDATA2 out=WANT(rename=(_NAME_=indix));run;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2022 13:39:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/adjusting-the-data-based-on-their-rows/m-p/806767#M317929</guid>
      <dc:creator>Abdulla1</dc:creator>
      <dc:date>2022-04-08T13:39:07Z</dc:date>
    </item>
    <item>
      <title>Re: adjusting the data based on their rows.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/adjusting-the-data-based-on-their-rows/m-p/806768#M317930</link>
      <description>Thank you ballardw&lt;BR /&gt;That was very helpful.</description>
      <pubDate>Fri, 08 Apr 2022 13:44:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/adjusting-the-data-based-on-their-rows/m-p/806768#M317930</guid>
      <dc:creator>Abdulla1</dc:creator>
      <dc:date>2022-04-08T13:44:28Z</dc:date>
    </item>
  </channel>
</rss>

