<?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: sas proc in SAS Health and Life Sciences</title>
    <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/sas-proc/m-p/44351#M1322</link>
    <description>If I am correct with your post message, here is one approach to convert a SAS dataset having multiple variables into a new SAS dataset, each observation/value transposed to a separate data observation (using a single variable).&lt;BR /&gt;
&lt;BR /&gt;
For a given SAS dataset, using a SAS DATA step approach, input the SAS file with a SET stmt, declare a SAS variable, either numeric or character, and using an ARRAY, assign each element in the array to the declared variable and issue an output to generate a separate observation.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Recommend using the SAS support  &lt;A href="http://support.sas.com/" target="_blank"&gt;http://support.sas.com/&lt;/A&gt;  and its SEARCH facility for SAS-host documentation and technical/conference papers.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
SAS Language Concepts: DATA Step Processing&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/lrcon/61722/HTML/default/a001281588.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrcon/61722/HTML/default/a001281588.htm&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
A Hands-On Introduction to SAS® DATA Step Programming&lt;BR /&gt;
Debbie Buck, D. B. &amp;amp; P. Associates, Houston, TX&lt;BR /&gt;
&lt;A href="http://www2.sas.com/proceedings/sugi30/134-30.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/sugi30/134-30.pdf&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
* create some sample data to use with this exercise;&lt;BR /&gt;
data temp;&lt;BR /&gt;
input (x1-x5) ($);&lt;BR /&gt;
datalines;&lt;BR /&gt;
x1 x2 x3 x4 x5&lt;BR /&gt;
run;&lt;BR /&gt;
* convert a horizontal SAS dataset to vertical, one obs per variable/value combination. ;&lt;BR /&gt;
data temp_vertical;&lt;BR /&gt;
set temp;&lt;BR /&gt;
array a_allvars (*) $ _all_;&lt;BR /&gt;
* declare output var attribute&lt;BR /&gt;
attrib x length=$2 label='transposed obs/var value';&lt;BR /&gt;
do i=1 to dim(a_allvars);&lt;BR /&gt;
  x = a_allvars(i);&lt;BR /&gt;
  * putlog "&amp;gt;DIAG_INFO&amp;gt;" / _ALL_;&lt;BR /&gt;
  output;&lt;BR /&gt;
end;&lt;BR /&gt;
run;</description>
    <pubDate>Sun, 14 Jun 2009 14:56:53 GMT</pubDate>
    <dc:creator>sbb</dc:creator>
    <dc:date>2009-06-14T14:56:53Z</dc:date>
    <item>
      <title>sas proc</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/sas-proc/m-p/44350#M1321</link>
      <description>how we change a variable into observation</description>
      <pubDate>Sun, 14 Jun 2009 02:21:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/sas-proc/m-p/44350#M1321</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-06-14T02:21:40Z</dc:date>
    </item>
    <item>
      <title>Re: sas proc</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/sas-proc/m-p/44351#M1322</link>
      <description>If I am correct with your post message, here is one approach to convert a SAS dataset having multiple variables into a new SAS dataset, each observation/value transposed to a separate data observation (using a single variable).&lt;BR /&gt;
&lt;BR /&gt;
For a given SAS dataset, using a SAS DATA step approach, input the SAS file with a SET stmt, declare a SAS variable, either numeric or character, and using an ARRAY, assign each element in the array to the declared variable and issue an output to generate a separate observation.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Recommend using the SAS support  &lt;A href="http://support.sas.com/" target="_blank"&gt;http://support.sas.com/&lt;/A&gt;  and its SEARCH facility for SAS-host documentation and technical/conference papers.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
SAS Language Concepts: DATA Step Processing&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/lrcon/61722/HTML/default/a001281588.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrcon/61722/HTML/default/a001281588.htm&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
A Hands-On Introduction to SAS® DATA Step Programming&lt;BR /&gt;
Debbie Buck, D. B. &amp;amp; P. Associates, Houston, TX&lt;BR /&gt;
&lt;A href="http://www2.sas.com/proceedings/sugi30/134-30.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/sugi30/134-30.pdf&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
* create some sample data to use with this exercise;&lt;BR /&gt;
data temp;&lt;BR /&gt;
input (x1-x5) ($);&lt;BR /&gt;
datalines;&lt;BR /&gt;
x1 x2 x3 x4 x5&lt;BR /&gt;
run;&lt;BR /&gt;
* convert a horizontal SAS dataset to vertical, one obs per variable/value combination. ;&lt;BR /&gt;
data temp_vertical;&lt;BR /&gt;
set temp;&lt;BR /&gt;
array a_allvars (*) $ _all_;&lt;BR /&gt;
* declare output var attribute&lt;BR /&gt;
attrib x length=$2 label='transposed obs/var value';&lt;BR /&gt;
do i=1 to dim(a_allvars);&lt;BR /&gt;
  x = a_allvars(i);&lt;BR /&gt;
  * putlog "&amp;gt;DIAG_INFO&amp;gt;" / _ALL_;&lt;BR /&gt;
  output;&lt;BR /&gt;
end;&lt;BR /&gt;
run;</description>
      <pubDate>Sun, 14 Jun 2009 14:56:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/sas-proc/m-p/44351#M1322</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-06-14T14:56:53Z</dc:date>
    </item>
    <item>
      <title>Re: sas proc</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/sas-proc/m-p/44352#M1323</link>
      <description>Hi&lt;BR /&gt;
Thanks a lot for this information</description>
      <pubDate>Wed, 11 Nov 2009 09:56:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/sas-proc/m-p/44352#M1323</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-11-11T09:56:24Z</dc:date>
    </item>
  </channel>
</rss>

