<?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: how to transpose variables into observations in a data step? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/how-to-transpose-variables-into-observations-in-a-data-step/m-p/101077#M28367</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your help. I've got one other question.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a number of observations sorted by a var1 and I want to find the median of var1 of these observations in a data step. I know I can do n=_n_; which will add the variable with the observation number. But then how can I get the middle observation (if the n is odd) or average the two middle observations (if the n is even). I'd like to assume in my code that I don't know the number of observations that exists in my data set.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 16 Dec 2012 23:28:59 GMT</pubDate>
    <dc:creator>eggman2001</dc:creator>
    <dc:date>2012-12-16T23:28:59Z</dc:date>
    <item>
      <title>how to transpose variables into observations in a data step?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-transpose-variables-into-observations-in-a-data-step/m-p/101075#M28365</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, I have a single row of data in my data data with probably 20 variables. I'm interested in converting this to separate observations but without using proc transpose. I know that I can do data foo; set my_data; to read in my data set. Then I thought I might be able to do something like input my_var @@; in order to covert the variables into observations but it looks like if I use the input statement, I also need to follow it with the datalines and then the data hardcoded in.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could someone steer me in the right direction?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 16 Dec 2012 22:45:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-transpose-variables-into-observations-in-a-data-step/m-p/101075#M28365</guid>
      <dc:creator>eggman2001</dc:creator>
      <dc:date>2012-12-16T22:45:45Z</dc:date>
    </item>
    <item>
      <title>Re: how to transpose variables into observations in a data step?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-transpose-variables-into-observations-in-a-data-step/m-p/101076#M28366</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not sure if this is what you want, but I think it meets your description:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input var1-var10 col1-col10;&lt;/P&gt;&lt;P&gt;&amp;nbsp; cards;&lt;/P&gt;&lt;P&gt;1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want (keep=variable);&lt;/P&gt;&lt;P&gt;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; array vars _all_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do over vars;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; variable=vars;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 16 Dec 2012 23:07:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-transpose-variables-into-observations-in-a-data-step/m-p/101076#M28366</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-12-16T23:07:13Z</dc:date>
    </item>
    <item>
      <title>Re: how to transpose variables into observations in a data step?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-transpose-variables-into-observations-in-a-data-step/m-p/101077#M28367</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your help. I've got one other question.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a number of observations sorted by a var1 and I want to find the median of var1 of these observations in a data step. I know I can do n=_n_; which will add the variable with the observation number. But then how can I get the middle observation (if the n is odd) or average the two middle observations (if the n is even). I'd like to assume in my code that I don't know the number of observations that exists in my data set.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 16 Dec 2012 23:28:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-transpose-variables-into-observations-in-a-data-step/m-p/101077#M28367</guid>
      <dc:creator>eggman2001</dc:creator>
      <dc:date>2012-12-16T23:28:59Z</dc:date>
    </item>
  </channel>
</rss>

