<?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: Help with repeating values dataset from Oracle Clinical in SAS Health and Life Sciences</title>
    <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Help-with-repeating-values-dataset-from-Oracle-Clinical/m-p/25113#M1057</link>
    <description>Hey Flip, &lt;BR /&gt;
I implemented you approach on my dataset and everything works fine except for one.&lt;BR /&gt;
:-(&lt;BR /&gt;
&lt;BR /&gt;
If you see in the example 101-1 has only two meds and doses but in the output dataset , I don't know why but even 101-1 has three meds and doses. The third one is same as 100-1 records 3rd med name and dose which is "SY" and "69mg".&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
&lt;BR /&gt;
Addy</description>
    <pubDate>Thu, 03 Dec 2009 18:38:44 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2009-12-03T18:38:44Z</dc:date>
    <item>
      <title>Help with repeating values dataset from Oracle Clinical</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Help-with-repeating-values-dataset-from-Oracle-Clinical/m-p/25111#M1055</link>
      <description>Hi Group,&lt;BR /&gt;
I have a dataset(Meds) from Oracle Clinical. It looks something like this&lt;BR /&gt;
&lt;BR /&gt;
ID	Vi	Y_N     	Nam 	Dose&lt;BR /&gt;
100	1	Y		Dilt	10mg&lt;BR /&gt;
100	1			Rel	10mg&lt;BR /&gt;
100	1			Sy	 69mg&lt;BR /&gt;
101	1	Y		RG	 30mg&lt;BR /&gt;
101	1			Cal	 20mg&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
so now I would like to flip this around to one row for ID*Vi like this below&lt;BR /&gt;
&lt;BR /&gt;
ID	VI	Y_N	 MD1	 MD2	  MD3    DS1   DS2    DS3&lt;BR /&gt;
100	1	Y	 Dilt    Rel    SY     10mg  10mg   9mg&lt;BR /&gt;
101	1	Y	 RG    Ca      .        30mg  20mg		  .&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Here is what I did. I'm new to SAS so my code looks funny. HEre is it.&lt;BR /&gt;
&lt;BR /&gt;
Proc sort data=Meds; by idno vi;Run;&lt;BR /&gt;
&lt;BR /&gt;
Data Med1;set Meds;by idno vi;if first.idno;&lt;BR /&gt;
Keep idno vi y_n;Run;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
proc transpose data=Meds out=Med2 prefix=Md_Nm;&lt;BR /&gt;
by idno vi;&lt;BR /&gt;
Var NAM ;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
proc transpose data=Meds out=Med3 prefix=Md_Ds;&lt;BR /&gt;
by idno vi;&lt;BR /&gt;
Var DOSE ;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
Now I merge these three datasets ;&lt;BR /&gt;
&lt;BR /&gt;
Data Medications;merge med1 med2 med3;by idno vi;Run;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
I can use this method here(just two variables name and dose) but if I have to use the same for a dataset with 20 variables it is too much.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Can someone suggest me a way around to solve this issue?&lt;BR /&gt;
&lt;BR /&gt;
Thanks for your time.&lt;BR /&gt;
&lt;BR /&gt;
Regards,&lt;BR /&gt;
Addy</description>
      <pubDate>Thu, 03 Dec 2009 17:35:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Help-with-repeating-values-dataset-from-Oracle-Clinical/m-p/25111#M1055</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-12-03T17:35:15Z</dc:date>
    </item>
    <item>
      <title>Re: Help with repeating values dataset from Oracle Clinical</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Help-with-repeating-values-dataset-from-Oracle-Clinical/m-p/25112#M1056</link>
      <description>You can get more control over transposing using a datastep with arrays.  Here is a small example that may help you out.&lt;BR /&gt;
&lt;BR /&gt;
data two(drop = Y_N nam Dose);&lt;BR /&gt;
set one;&lt;BR /&gt;
by ID Vi ;&lt;BR /&gt;
retain med1-med3 dose_1-dose_3 nY_N;&lt;BR /&gt;
array med (3) $;&lt;BR /&gt;
array dose_ (3) $;&lt;BR /&gt;
if first.vi then do;&lt;BR /&gt;
i = 0;&lt;BR /&gt;
nY_N = Y_N;&lt;BR /&gt;
end;&lt;BR /&gt;
 i+1;&lt;BR /&gt;
med(i) = nam;&lt;BR /&gt;
dose_(i) = dose;&lt;BR /&gt;
if last.vi then output;&lt;BR /&gt;
&lt;BR /&gt;
run;</description>
      <pubDate>Thu, 03 Dec 2009 18:01:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Help-with-repeating-values-dataset-from-Oracle-Clinical/m-p/25112#M1056</guid>
      <dc:creator>Flip</dc:creator>
      <dc:date>2009-12-03T18:01:52Z</dc:date>
    </item>
    <item>
      <title>Re: Help with repeating values dataset from Oracle Clinical</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Help-with-repeating-values-dataset-from-Oracle-Clinical/m-p/25113#M1057</link>
      <description>Hey Flip, &lt;BR /&gt;
I implemented you approach on my dataset and everything works fine except for one.&lt;BR /&gt;
:-(&lt;BR /&gt;
&lt;BR /&gt;
If you see in the example 101-1 has only two meds and doses but in the output dataset , I don't know why but even 101-1 has three meds and doses. The third one is same as 100-1 records 3rd med name and dose which is "SY" and "69mg".&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
&lt;BR /&gt;
Addy</description>
      <pubDate>Thu, 03 Dec 2009 18:38:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Help-with-repeating-values-dataset-from-Oracle-Clinical/m-p/25113#M1057</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-12-03T18:38:44Z</dc:date>
    </item>
    <item>
      <title>Re: Help with repeating values dataset from Oracle Clinical</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Help-with-repeating-values-dataset-from-Oracle-Clinical/m-p/25114#M1058</link>
      <description>Sorry about that.  With the retain in the if first.xxx  set all the values to empty or missing.  Otherwise the values from the last time are retained.&lt;BR /&gt;
&lt;BR /&gt;
So you wil need to loop over the array and set med(i) = ' '</description>
      <pubDate>Thu, 03 Dec 2009 19:24:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Help-with-repeating-values-dataset-from-Oracle-Clinical/m-p/25114#M1058</guid>
      <dc:creator>Flip</dc:creator>
      <dc:date>2009-12-03T19:24:00Z</dc:date>
    </item>
    <item>
      <title>Re: Help with repeating values dataset from Oracle Clinical</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Help-with-repeating-values-dataset-from-Oracle-Clinical/m-p/25115#M1059</link>
      <description>I get error if I use this. may be I have placed the IF statement in wrong order. I did put med(i)='' ; dose_(i)='' in the same if first.vi statement but still getting error.&lt;BR /&gt;
&lt;BR /&gt;
data two(drop = Y_N nam Dose);&lt;BR /&gt;
set one;&lt;BR /&gt;
by ID Vi ;&lt;BR /&gt;
retain med1-med3 dose_1-dose_3 nY_N;&lt;BR /&gt;
array med (3) $;&lt;BR /&gt;
array dose_ (3) $;&lt;BR /&gt;
if first.vi then do;&lt;BR /&gt;
med(i)='';dose_(i)='';&lt;BR /&gt;
end;&lt;BR /&gt;
if first.vi then do;&lt;BR /&gt;
i = 0;&lt;BR /&gt;
nY_N = Y_N;&lt;BR /&gt;
end;&lt;BR /&gt;
i+1;&lt;BR /&gt;
med(i) = nam;&lt;BR /&gt;
dose_(i) = dose;&lt;BR /&gt;
if last.vi then output;&lt;BR /&gt;
&lt;BR /&gt;
run; &lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Thanks&lt;BR /&gt;
Addy</description>
      <pubDate>Thu, 03 Dec 2009 20:23:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Help-with-repeating-values-dataset-from-Oracle-Clinical/m-p/25115#M1059</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-12-03T20:23:04Z</dc:date>
    </item>
    <item>
      <title>Re: Help with repeating values dataset from Oracle Clinical</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Help-with-repeating-values-dataset-from-Oracle-Clinical/m-p/25116#M1060</link>
      <description>ALmost there, you need to loop i over the range of values as:&lt;BR /&gt;
data two(drop = Y_N nam Dose);&lt;BR /&gt;
set one;&lt;BR /&gt;
by ID Vi ;&lt;BR /&gt;
retain med1-med3 dose_1-dose_3 nY_N;&lt;BR /&gt;
array med (3) $;&lt;BR /&gt;
array dose_ (3) $;&lt;BR /&gt;
if first.vi then do;&lt;BR /&gt;
do i = 1 to 3;&lt;BR /&gt;
med(i)='';dose_(i)='';&lt;BR /&gt;
end;&lt;BR /&gt;
i = 0;&lt;BR /&gt;
nY_N = Y_N;&lt;BR /&gt;
end;&lt;BR /&gt;
i+1;&lt;BR /&gt;
med(i) = nam;&lt;BR /&gt;
dose_(i) = dose;&lt;BR /&gt;
if last.vi then output;&lt;BR /&gt;
&lt;BR /&gt;
run;</description>
      <pubDate>Thu, 03 Dec 2009 20:33:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Help-with-repeating-values-dataset-from-Oracle-Clinical/m-p/25116#M1060</guid>
      <dc:creator>Flip</dc:creator>
      <dc:date>2009-12-03T20:33:26Z</dc:date>
    </item>
    <item>
      <title>Re: Help with repeating values dataset from Oracle Clinical</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Help-with-repeating-values-dataset-from-Oracle-Clinical/m-p/25117#M1061</link>
      <description>Appreciate you help.&lt;BR /&gt;
&lt;BR /&gt;
Addy</description>
      <pubDate>Thu, 03 Dec 2009 21:14:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Help-with-repeating-values-dataset-from-Oracle-Clinical/m-p/25117#M1061</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-12-03T21:14:21Z</dc:date>
    </item>
  </channel>
</rss>

