<?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 Create a dataset with mutiple new Obs in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-Create-a-dataset-with-mutiple-new-Obs/m-p/49679#M10346</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Art&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Gonna go for Linlins option as a novel insight for me...and I don;t like arrays! :smileyshocked:&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 17 Nov 2011 16:31:32 GMT</pubDate>
    <dc:creator>slolay</dc:creator>
    <dc:date>2011-11-17T16:31:32Z</dc:date>
    <item>
      <title>How to Create a dataset with mutiple new Obs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Create-a-dataset-with-mutiple-new-Obs/m-p/49673#M10340</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Apologies for the semi-descriptive title...if any one can suggest a better one and I can change it then please let me know!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OK, to the problem, sounds an easy one but can;t think of an easy solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a dataset of subject and timepoint info.&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;001&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Screening&lt;/P&gt;&lt;P&gt;001&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Visit 1&lt;/P&gt;&lt;P&gt;001&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Visit 2&lt;/P&gt;&lt;P&gt;002&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Screening &lt;/P&gt;&lt;P&gt;002&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Visit 1&lt;/P&gt;&lt;P&gt;002&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Visit 3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to create a new dataset where each subject in the output dataset has 4 records per timepoint? They have 4 tests done at each timepoint&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Test1&lt;/P&gt;&lt;P&gt;Test2&lt;/P&gt;&lt;P&gt;Test3&lt;/P&gt;&lt;P&gt;Test4&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So final dataset should look something like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;001&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Screening&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Test1&lt;/P&gt;&lt;P&gt;001&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Screening&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Test2&lt;/P&gt;&lt;P&gt;001&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Screening&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Test3&lt;/P&gt;&lt;P&gt;001&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Screening&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Test4&lt;/P&gt;&lt;P&gt;001&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Visit 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Test1&lt;/P&gt;&lt;P&gt;001&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Visit 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Test2&lt;/P&gt;&lt;P&gt;001&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Visit 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Test3&lt;/P&gt;&lt;P&gt;001&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Visit 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Test4&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Steve&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The output data will be exported to excel and then filled in by hand&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Nov 2011 15:41:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Create-a-dataset-with-mutiple-new-Obs/m-p/49673#M10340</guid>
      <dc:creator>slolay</dc:creator>
      <dc:date>2011-11-17T15:41:30Z</dc:date>
    </item>
    <item>
      <title>How to Create a dataset with mutiple new Obs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Create-a-dataset-with-mutiple-new-Obs/m-p/49674#M10341</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data want (drop=i);&lt;/P&gt;&lt;P&gt;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do i=1 to 4;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; newvar='test'||put(i,1.);&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>Thu, 17 Nov 2011 15:56:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Create-a-dataset-with-mutiple-new-Obs/m-p/49674#M10341</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-11-17T15:56:26Z</dc:date>
    </item>
    <item>
      <title>How to Create a dataset with mutiple new Obs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Create-a-dataset-with-mutiple-new-Obs/m-p/49675#M10342</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Art&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sorry the test1-test4 was an example&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;test could be like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;RBC&lt;/P&gt;&lt;P&gt;WBC&lt;/P&gt;&lt;P&gt;Urine&lt;/P&gt;&lt;P&gt;Platelets&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not in a sequential number as such&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Apologies for the confusion&lt;/P&gt;&lt;P&gt;Steve&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Nov 2011 16:03:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Create-a-dataset-with-mutiple-new-Obs/m-p/49675#M10342</guid>
      <dc:creator>slolay</dc:creator>
      <dc:date>2011-11-17T16:03:07Z</dc:date>
    </item>
    <item>
      <title>How to Create a dataset with mutiple new Obs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Create-a-dataset-with-mutiple-new-Obs/m-p/49676#M10343</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Then how about:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want (drop=i _:);&lt;/P&gt;&lt;P&gt;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; array _new(4) $10. ('RBC' 'WBC' 'Urine' 'Platelets');&lt;/P&gt;&lt;P&gt;&amp;nbsp; do i=1 to 4;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; newvar=_new(i);&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>Thu, 17 Nov 2011 16:13:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Create-a-dataset-with-mutiple-new-Obs/m-p/49676#M10343</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-11-17T16:13:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to Create a dataset with mutiple new Obs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Create-a-dataset-with-mutiple-new-Obs/m-p/49677#M10344</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; id $ visit :&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: teal; font-size: 10pt;"&gt;$9.&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;cards&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffc0; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;001&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Screening&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffc0; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;001&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Visit1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffc0; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;001&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Visit2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffc0; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;002&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Screening &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffc0; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;002&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Visit1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffc0; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;002&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Visit3&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; want;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; test=&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: purple; font-size: 10pt;"&gt;"test1"&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: purple; font-size: 10pt;"&gt;"test2"&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: purple; font-size: 10pt;"&gt;"test3"&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: purple; font-size: 10pt;"&gt;"test4"&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;output&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;print&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Nov 2011 16:17:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Create-a-dataset-with-mutiple-new-Obs/m-p/49677#M10344</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2011-11-17T16:17:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to Create a dataset with mutiple new Obs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Create-a-dataset-with-mutiple-new-Obs/m-p/49678#M10345</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Linlin&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you possibly expalin the logic here or tell me where in the SAS documentation I can read up on this.&amp;nbsp; I've not seen this do loop construction/use before.&amp;nbsp; Interesting.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Steve&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Nov 2011 16:30:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Create-a-dataset-with-mutiple-new-Obs/m-p/49678#M10345</guid>
      <dc:creator>slolay</dc:creator>
      <dc:date>2011-11-17T16:30:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to Create a dataset with mutiple new Obs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Create-a-dataset-with-mutiple-new-Obs/m-p/49679#M10346</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Art&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Gonna go for Linlins option as a novel insight for me...and I don;t like arrays! :smileyshocked:&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Nov 2011 16:31:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Create-a-dataset-with-mutiple-new-Obs/m-p/49679#M10346</guid>
      <dc:creator>slolay</dc:creator>
      <dc:date>2011-11-17T16:31:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to Create a dataset with mutiple new Obs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Create-a-dataset-with-mutiple-new-Obs/m-p/49680#M10347</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Understood.&amp;nbsp; Linlin's suggested code was an example of one of the forms of an interative do loop.&amp;nbsp; It is documented at: &lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000201276.htm"&gt;http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000201276.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, in your case, you will also need to include a length statement or else the length will be determined by the first value in the list.&amp;nbsp; e.g.,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; length test $10;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do test='RBC','WBC','Urine','Platelets';&lt;/P&gt;&lt;P&gt;&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>Thu, 17 Nov 2011 16:39:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Create-a-dataset-with-mutiple-new-Obs/m-p/49680#M10347</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-11-17T16:39:25Z</dc:date>
    </item>
  </channel>
</rss>

