<?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 Repeat a set of values for each ID and treatment phase in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Repeat-a-set-of-values-for-each-ID-and-treatment-phase/m-p/783929#M250083</link>
    <description>&lt;P&gt;Is there a simple way to repeat the following values for each distinct ID and phase combination?&amp;nbsp;&lt;U&gt;Note:&lt;/U&gt; Not all subjects went through all phases.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;* Values to Repeat;
data _param00_;
 input paramcd $ paramn @@;
 cards;
	MALINPCR	1	MALINTHK	2	PCRDNS		3
	THKDNS		4	PKPCRDNS	5	PKTHKDNS	6
	FPDNSPCR	7	FPDNSTHK	8	DURPCR		9
 ;
run;

* ID Variables to Add Values to;
proc sql;
 create table _param0_ as
 	select distinct usubjid, aphase
		from phase
		where not missing(avalc) or not missing(aval);
quit; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I want the resulting dataset to be like:&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; PHASE1&amp;nbsp; &amp;nbsp;MALINPCR&amp;nbsp; &amp;nbsp;1&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; PHASE1&amp;nbsp; &amp;nbsp;MALINTHK&amp;nbsp; &amp;nbsp;2&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; PHASE1&amp;nbsp; &amp;nbsp;PCRDNS&amp;nbsp; &amp;nbsp; &amp;nbsp; 3&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; PHASE1&amp;nbsp; &lt;EM&gt;etc.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; PHASE2&amp;nbsp; &amp;nbsp;MALINPCR&amp;nbsp; &amp;nbsp;1&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; PHASE2&amp;nbsp; &lt;EM&gt;etc.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;2&amp;nbsp; PHASE1&amp;nbsp; &amp;nbsp;MALINPCR&amp;nbsp; &amp;nbsp;1&lt;/P&gt;
&lt;P&gt;2&amp;nbsp; PHASE1&amp;nbsp; &lt;EM&gt;etc.&lt;/EM&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 03 Dec 2021 14:14:46 GMT</pubDate>
    <dc:creator>mariko5797</dc:creator>
    <dc:date>2021-12-03T14:14:46Z</dc:date>
    <item>
      <title>Repeat a set of values for each ID and treatment phase</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Repeat-a-set-of-values-for-each-ID-and-treatment-phase/m-p/783929#M250083</link>
      <description>&lt;P&gt;Is there a simple way to repeat the following values for each distinct ID and phase combination?&amp;nbsp;&lt;U&gt;Note:&lt;/U&gt; Not all subjects went through all phases.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;* Values to Repeat;
data _param00_;
 input paramcd $ paramn @@;
 cards;
	MALINPCR	1	MALINTHK	2	PCRDNS		3
	THKDNS		4	PKPCRDNS	5	PKTHKDNS	6
	FPDNSPCR	7	FPDNSTHK	8	DURPCR		9
 ;
run;

* ID Variables to Add Values to;
proc sql;
 create table _param0_ as
 	select distinct usubjid, aphase
		from phase
		where not missing(avalc) or not missing(aval);
quit; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I want the resulting dataset to be like:&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; PHASE1&amp;nbsp; &amp;nbsp;MALINPCR&amp;nbsp; &amp;nbsp;1&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; PHASE1&amp;nbsp; &amp;nbsp;MALINTHK&amp;nbsp; &amp;nbsp;2&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; PHASE1&amp;nbsp; &amp;nbsp;PCRDNS&amp;nbsp; &amp;nbsp; &amp;nbsp; 3&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; PHASE1&amp;nbsp; &lt;EM&gt;etc.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; PHASE2&amp;nbsp; &amp;nbsp;MALINPCR&amp;nbsp; &amp;nbsp;1&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; PHASE2&amp;nbsp; &lt;EM&gt;etc.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;2&amp;nbsp; PHASE1&amp;nbsp; &amp;nbsp;MALINPCR&amp;nbsp; &amp;nbsp;1&lt;/P&gt;
&lt;P&gt;2&amp;nbsp; PHASE1&amp;nbsp; &lt;EM&gt;etc.&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Dec 2021 14:14:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Repeat-a-set-of-values-for-each-ID-and-treatment-phase/m-p/783929#M250083</guid>
      <dc:creator>mariko5797</dc:creator>
      <dc:date>2021-12-03T14:14:46Z</dc:date>
    </item>
    <item>
      <title>Re: Repeat a set of values for each ID and treatment phase</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Repeat-a-set-of-values-for-each-ID-and-treatment-phase/m-p/783932#M250084</link>
      <description>&lt;P&gt;Cartesian join in PROC SQL&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;UNTESTED CODE (because no example data has been provided)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
    create table want as select a.*,b.paramcd,b.paramn
    from _param0_,param00_;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 03 Dec 2021 14:20:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Repeat-a-set-of-values-for-each-ID-and-treatment-phase/m-p/783932#M250084</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-12-03T14:20:01Z</dc:date>
    </item>
  </channel>
</rss>

