<?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 outputting the content of a variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/outputting-the-content-of-a-variable/m-p/751684#M236663</link>
    <description>&lt;P&gt;Dear all,&lt;/P&gt;
&lt;P&gt;if I have a data that looks like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data myattrmap;
	infile datalines;
	input id $6. research_type $6. ;
	datalines;
100  RY2819
20   RC7856
1    RA5034 
2    RF1044 
3    RW3399 
4    RV6060 
4667 RR7034
;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and I want to output the first, second, third ..... reseaches group and sorted by the id's. How can I do that?&lt;/P&gt;</description>
    <pubDate>Fri, 02 Jul 2021 10:46:05 GMT</pubDate>
    <dc:creator>Anita_n</dc:creator>
    <dc:date>2021-07-02T10:46:05Z</dc:date>
    <item>
      <title>outputting the content of a variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/outputting-the-content-of-a-variable/m-p/751684#M236663</link>
      <description>&lt;P&gt;Dear all,&lt;/P&gt;
&lt;P&gt;if I have a data that looks like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data myattrmap;
	infile datalines;
	input id $6. research_type $6. ;
	datalines;
100  RY2819
20   RC7856
1    RA5034 
2    RF1044 
3    RW3399 
4    RV6060 
4667 RR7034
;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and I want to output the first, second, third ..... reseaches group and sorted by the id's. How can I do that?&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jul 2021 10:46:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/outputting-the-content-of-a-variable/m-p/751684#M236663</guid>
      <dc:creator>Anita_n</dc:creator>
      <dc:date>2021-07-02T10:46:05Z</dc:date>
    </item>
    <item>
      <title>Re: outputting the content of a variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/outputting-the-content-of-a-variable/m-p/751688#M236665</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;I want to output the first, second, third ..... reseaches group and sorted by the id's&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm not sure really what this means. By output, you mean you want this is a data set? Can you show us the desired output?&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jul 2021 10:48:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/outputting-the-content-of-a-variable/m-p/751688#M236665</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-07-02T10:48:42Z</dc:date>
    </item>
    <item>
      <title>Re: outputting the content of a variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/outputting-the-content-of-a-variable/m-p/751689#M236666</link>
      <description>&lt;P&gt;I don't see "research group" in the data you have posted.&lt;/P&gt;
&lt;P&gt;Depending on the expected result, either use proc sort + proc print or proc report, maybe more complex steps are required, but because you have not told us what exactly is expected, i can't recommend anything.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jul 2021 10:52:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/outputting-the-content-of-a-variable/m-p/751689#M236666</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2021-07-02T10:52:19Z</dc:date>
    </item>
    <item>
      <title>Re: outputting the content of a variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/outputting-the-content-of-a-variable/m-p/751704#M236672</link>
      <description>&lt;P&gt;sorry for not explaining well. The variable is research type, it was a mistake, I made.&lt;/P&gt;
&lt;P&gt;Actually the data set has many variables which I wish to reduce to only the id and the research type.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The research type has subgroups e.g. RY2819 has subgroups&amp;nbsp;RY2819_1,&amp;nbsp;RY2819_2,&amp;nbsp;RY2819_3. So that I then have, something like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;data myattrmap;
	infile datalines;
	input id $6. research_type $6. sub_research ;
	datalines;
100  RY2819 RY2819_1
100  RY2819 RY2819_2
100  RY2819 RY2819_3
20   RC7856 RC7856_1
20   RC7856 RC7856_2
1    RA5034 RA5034_1
1    RA5034 RA5034_2
1    RA5034 RA5034_3
2    RF1044 RF1044_2
2    RF1044 RF1044_6
3    RW3399 RW3399_3
3    RW3399 RW3399_4
3    RW3399 RW3399_5
4    RV6060 RV6060_1
4    RV6060 RV6060_2
4    RV6060 RV6060_3
4667 RR7034 RR7034_2
4667 RR7034 RR7034_3
;
run;&lt;/LI-CODE&gt;
&lt;P&gt;I need an outputted Sequential number showing the 1., 2. 3., ........research type within the id&lt;/P&gt;
&lt;P&gt;so that at the end my output looks like this&lt;/P&gt;
&lt;P&gt;ID&amp;nbsp; seq_num research_type sub_research&lt;/P&gt;
&lt;P&gt;100&amp;nbsp; 1&amp;nbsp; RY2819 RY2819_1&lt;BR /&gt;100&amp;nbsp; 2&amp;nbsp; RY2819 RY2819_2&lt;BR /&gt;100&amp;nbsp; 3&amp;nbsp; &amp;nbsp;RY2819 RY2819_3&lt;BR /&gt;&amp;nbsp; 20&amp;nbsp; 1&amp;nbsp; RC7856 RC7856_1&lt;BR /&gt;&amp;nbsp; 20&amp;nbsp; 2&amp;nbsp; &amp;nbsp;RC7856 RC7856_2&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;1 1&amp;nbsp; &amp;nbsp;RA5034 RA5034_1&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; 2&amp;nbsp; RA5034 RA5034_2&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;1 3&amp;nbsp; &amp;nbsp;RA5034 RA5034_3&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;2 1&amp;nbsp; &amp;nbsp;RF1044 RF1044_2&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;2 2&amp;nbsp; &amp;nbsp;RF1044 RF1044_6&lt;BR /&gt;&amp;nbsp; &amp;nbsp; 3&amp;nbsp; 1&amp;nbsp; &amp;nbsp;RW3399 RW3399_3&lt;BR /&gt;&amp;nbsp; &amp;nbsp; 3&amp;nbsp; 2&amp;nbsp; &amp;nbsp;RW3399 RW3399_4&lt;BR /&gt;&amp;nbsp; &amp;nbsp; 3&amp;nbsp; 3&amp;nbsp; &amp;nbsp;RW3399 RW3399_5&lt;BR /&gt;&amp;nbsp; &amp;nbsp; 4 1&amp;nbsp; &amp;nbsp; RV6060 RV6060_1&lt;BR /&gt;&amp;nbsp; &amp;nbsp; 4 2&amp;nbsp; &amp;nbsp; RV6060 RV6060_2&lt;BR /&gt;&amp;nbsp; &amp;nbsp; 4 3&amp;nbsp; &amp;nbsp; RV6060 RV6060_3&lt;BR /&gt;4667 1&amp;nbsp; RR7034 RR7034_2&lt;BR /&gt;4667&amp;nbsp; 2 RR7034 RR7034_3&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope I have now clearly explained it&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jul 2021 11:57:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/outputting-the-content-of-a-variable/m-p/751704#M236672</guid>
      <dc:creator>Anita_n</dc:creator>
      <dc:date>2021-07-02T11:57:11Z</dc:date>
    </item>
    <item>
      <title>Re: outputting the content of a variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/outputting-the-content-of-a-variable/m-p/751715#M236678</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data myattrmap;
	infile datalines;
	input id @6 research_type $6. sub_research $10.;
	datalines;
100  RY2819 RY2819_1
100  RY2819 RY2819_2
100  RY2819 RY2819_3
20   RC7856 RC7856_1
20   RC7856 RC7856_2
1    RA5034 RA5034_1
1    RA5034 RA5034_2
1    RA5034 RA5034_3
2    RF1044 RF1044_2
2    RF1044 RF1044_6
3    RW3399 RW3399_3
3    RW3399 RW3399_4
3    RW3399 RW3399_5
4    RV6060 RV6060_1
4    RV6060 RV6060_2
4    RV6060 RV6060_3
4667 RR7034 RR7034_2
4667 RR7034 RR7034_3
;
run;
proc sort data=myattrmap;
    by research_type sub_research;
run;
data myattrmap1;
    set myattrmap;
    by research_type;
    if first.research_type then seq_num=0;
    seq_num+1;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 02 Jul 2021 12:33:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/outputting-the-content-of-a-variable/m-p/751715#M236678</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-07-02T12:33:30Z</dc:date>
    </item>
  </channel>
</rss>

