<?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 Time values past current values? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-Time-values-past-current-values/m-p/334574#M75576</link>
    <description>&lt;P&gt;Something as below could do (not tested):&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data long_WMQPCA;
	set long_WMQPCA;
	by SUBID time;
  output;

	if last.SUBID then 
    do;
      call missing(WMQPCA);
      _time=time+1;
      do Time = _time to 12;
        output;
      end;
    end;
  drop _time;

run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 21 Feb 2017 06:01:51 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2017-02-21T06:01:51Z</dc:date>
    <item>
      <title>How to create Time values past current values?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-Time-values-past-current-values/m-p/334570#M75575</link>
      <description>&lt;P&gt;I have a longitudinal dataset in long format below which has 7 subjects with Time coded 1 through 4 and a response WMQPCA for each time point:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/7359iC0CB4A97A60B9005/image-size/original?v=1.0&amp;amp;px=-1" alt="Screen Shot 2017-02-20 at 9.32.20 PM.png" title="Screen Shot 2017-02-20 at 9.32.20 PM.png" border="0" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to create missing data by creating time points 5 through 12 and having missing data for each other variable for those time points but I'm having some trouble doing so. Here is the code I have created so far:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data long_WMQPCA;
	set long_WMQPCA;
	by SUBID;
	if last.SUBID then do Time = 5;
	end;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Obviously this isn't working. Does anybody have any hints? Thank you.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Feb 2017 05:37:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-Time-values-past-current-values/m-p/334570#M75575</guid>
      <dc:creator>tbanh</dc:creator>
      <dc:date>2017-02-21T05:37:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to create Time values past current values?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-Time-values-past-current-values/m-p/334574#M75576</link>
      <description>&lt;P&gt;Something as below could do (not tested):&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data long_WMQPCA;
	set long_WMQPCA;
	by SUBID time;
  output;

	if last.SUBID then 
    do;
      call missing(WMQPCA);
      _time=time+1;
      do Time = _time to 12;
        output;
      end;
    end;
  drop _time;

run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 Feb 2017 06:01:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-Time-values-past-current-values/m-p/334574#M75576</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2017-02-21T06:01:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to create Time values past current values?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-Time-values-past-current-values/m-p/334630#M75591</link>
      <description>&lt;P&gt;This program does slightly more that you asked for.&amp;nbsp;&amp;nbsp; It creates 12 records per subject, with T=1 to 12, but accomodates missing T's of any pattern, not just 5 to 12.&amp;nbsp; It assumes data are sorted by T within subid:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;

  array present{12} _temporary_ (12*0);

  set have;
  by subid;
  present{t}=1;

  if last.subid then do T=1 to dim(present);
    if present{t} then set have;
    else call missing(wmqpca);
    output;
    present{t}=0;
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Feb 2017 12:20:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-Time-values-past-current-values/m-p/334630#M75591</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2017-02-21T12:20:29Z</dc:date>
    </item>
  </channel>
</rss>

