<?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: Create variable in SAS Studio</title>
    <link>https://communities.sas.com/t5/SAS-Studio/Create-variable/m-p/639050#M9005</link>
    <description>&lt;P&gt;So you want to flag the first observation for each Patient_ID and date with "Y" and any other observation with "N"? Assuming that the data is sorted by Patient_ID and date:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
	set have;
	by Patient_ID date;
	
	length status $ 1;

	status = ifc(first.date, 'Y', 'N');
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 10 Apr 2020 19:04:39 GMT</pubDate>
    <dc:creator>andreas_lds</dc:creator>
    <dc:date>2020-04-10T19:04:39Z</dc:date>
    <item>
      <title>Create variable</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Create-variable/m-p/639037#M9004</link>
      <description>&lt;PRE&gt;data have;
input Patient_ID $   date  Date9.     Activity $ ;
format date date9.;
datalines;
1234 20FEB2020 Football 
1234 20FEB2020 Basketball 
1234 25FEB2020 Ski 
1234 07SEP2020 Baseball &lt;/PRE&gt;&lt;P&gt;&amp;nbsp;How would I create a variable that says 'Y' to the first line that has patient 1234 playing football, and 'N' to person 1234 playing basketball because they are playing on the same day. I want to say 'Y' to person 1234 on 25FEB2020 and 'Y' for patient 1234 on 07SEP2020.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Apr 2020 18:11:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Create-variable/m-p/639037#M9004</guid>
      <dc:creator>mar0000</dc:creator>
      <dc:date>2020-04-10T18:11:42Z</dc:date>
    </item>
    <item>
      <title>Re: Create variable</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Create-variable/m-p/639050#M9005</link>
      <description>&lt;P&gt;So you want to flag the first observation for each Patient_ID and date with "Y" and any other observation with "N"? Assuming that the data is sorted by Patient_ID and date:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
	set have;
	by Patient_ID date;
	
	length status $ 1;

	status = ifc(first.date, 'Y', 'N');
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 10 Apr 2020 19:04:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Create-variable/m-p/639050#M9005</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2020-04-10T19:04:39Z</dc:date>
    </item>
  </channel>
</rss>

