<?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 categorical variables from several dates variable in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/create-categorical-variables-from-several-dates-variable/m-p/854195#M37608</link>
    <description>&lt;P&gt;Try this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;    array dfs dfs_fam1-dfs_fam50;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 17 Jan 2023 20:30:06 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2023-01-17T20:30:06Z</dc:date>
    <item>
      <title>create categorical variables from several dates variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/create-categorical-variables-from-several-dates-variable/m-p/854191#M37605</link>
      <description>&lt;P&gt;&lt;STRONG&gt;A.&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I have this data (short) with 50 date variables DFS_Fam1 - DFS_Fam50. Some observations do not have date value for&amp;nbsp;DFS_Fam1 - DFS_Fam50&lt;/P&gt;&lt;P&gt;I want to create variables that show if a date value is available, it is indicated as 1, and no date value = 0 or missing.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ID&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DFS_Fam1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;DFS_Fam2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;DFS_Fam3&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 01/01/2023&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 02/01/2023&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;03/01/2023&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 04/01/2023&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 05/01/2023&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;06/01/2023&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 05/01/2023&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example for observation 1, if DFS_Fam1,&amp;nbsp;DFS_Fam2,&amp;nbsp;DFS_Fam3 have date values, then New_A1=1,&amp;nbsp;New_A2=1,&amp;nbsp;New_A3=1 as shown (but up to whenever&amp;nbsp;DFS_Fam has dates)&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ID&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DFS_Fam1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;DFS_Fam2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;DFS_Fam3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; New_A1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;New_A2&amp;nbsp; &amp;nbsp;New_A3&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 01/01/2023&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 02/01/2023&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;03/01/2023&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 04/01/2023&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 05/01/2023&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;06/01/2023&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 05/01/2023&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is clinical data, everyone has DFS_Fam1 but not necessary&amp;nbsp;&amp;nbsp;DFS_Fam2 ,&amp;nbsp;&amp;nbsp;DFS_Fam3 up to&amp;nbsp;&amp;nbsp;DFS_Fam50, thus there would be missing dates.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I go about these without writing 50 lines of code?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;B. I would like to convert New_A to time points&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Data&lt;/STRONG&gt; long;&lt;/P&gt;&lt;P&gt;set short;&lt;/P&gt;&lt;P&gt;New=New_A1; time=&lt;STRONG&gt;0&lt;/STRONG&gt;; output;&lt;/P&gt;&lt;P&gt;New=New_A2; time=&lt;STRONG&gt;1&lt;/STRONG&gt;; output;&lt;/P&gt;&lt;P&gt;New=New_A3; time=2; output;&lt;/P&gt;&lt;P&gt;...&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ....&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .........&amp;nbsp; &amp;nbsp; &amp;nbsp;.......&lt;/P&gt;&lt;P&gt;New=New_A50; time=50; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I go about these without writing 50 lines of code?&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2023 20:05:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/create-categorical-variables-from-several-dates-variable/m-p/854191#M37605</guid>
      <dc:creator>femiajumobi1</dc:creator>
      <dc:date>2023-01-17T20:05:08Z</dc:date>
    </item>
    <item>
      <title>Re: create categorical variables from several dates variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/create-categorical-variables-from-several-dates-variable/m-p/854192#M37606</link>
      <description>&lt;P&gt;Use ARRAYs in a SAS data step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;UNTESTED CODE&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set have;
    array dfs dfs_:
    array new new_a1-new_a50;
    do i=1 to dim(dfs);
        if not missing(dfs(i)) then new(i)=1;
        else new(i)=0;
    end;
    drop i;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 17 Jan 2023 20:09:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/create-categorical-variables-from-several-dates-variable/m-p/854192#M37606</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-01-17T20:09:49Z</dc:date>
    </item>
    <item>
      <title>Re: create categorical variables from several dates variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/create-categorical-variables-from-several-dates-variable/m-p/854194#M37607</link>
      <description>SAS shows&lt;BR /&gt;&lt;BR /&gt;ERROR Mixing of implicit and explicit array subscription is not allowed.</description>
      <pubDate>Tue, 17 Jan 2023 20:27:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/create-categorical-variables-from-several-dates-variable/m-p/854194#M37607</guid>
      <dc:creator>femiajumobi1</dc:creator>
      <dc:date>2023-01-17T20:27:47Z</dc:date>
    </item>
    <item>
      <title>Re: create categorical variables from several dates variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/create-categorical-variables-from-several-dates-variable/m-p/854195#M37608</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;    array dfs dfs_fam1-dfs_fam50;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 17 Jan 2023 20:30:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/create-categorical-variables-from-several-dates-variable/m-p/854195#M37608</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-01-17T20:30:06Z</dc:date>
    </item>
    <item>
      <title>Re: create categorical variables from several dates variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/create-categorical-variables-from-several-dates-variable/m-p/854196#M37609</link>
      <description>This means that the variables are a combination of numeric and character types. &lt;BR /&gt;You may need to clean up the data before this step to ensure all dates are SAS numeric dates or character dates (not recommended). &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 17 Jan 2023 20:31:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/create-categorical-variables-from-several-dates-variable/m-p/854196#M37609</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-01-17T20:31:12Z</dc:date>
    </item>
    <item>
      <title>Re: create categorical variables from several dates variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/create-categorical-variables-from-several-dates-variable/m-p/854197#M37610</link>
      <description>Hi@Paige Miller. I rechecked the code and the 1st approach worked. Thanks.&lt;BR /&gt;&lt;BR /&gt;Kindly assist with Part B of my question above. I need to create time points before I move ahead to GEE. Thanks.</description>
      <pubDate>Tue, 17 Jan 2023 20:38:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/create-categorical-variables-from-several-dates-variable/m-p/854197#M37610</guid>
      <dc:creator>femiajumobi1</dc:creator>
      <dc:date>2023-01-17T20:38:51Z</dc:date>
    </item>
    <item>
      <title>Re: create categorical variables from several dates variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/create-categorical-variables-from-several-dates-variable/m-p/854198#M37611</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/436402"&gt;@femiajumobi1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;BR /&gt;Kindly assist with Part B of my question above. I need to create time points before I move ahead to GEE. Thanks.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Its one more line of code using the ARRAY variables, in the DO loop. Perhaps you could give it a try and if you get stuck, show us what you tried.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2023 20:42:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/create-categorical-variables-from-several-dates-variable/m-p/854198#M37611</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-01-17T20:42:15Z</dc:date>
    </item>
    <item>
      <title>Re: create categorical variables from several dates variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/create-categorical-variables-from-several-dates-variable/m-p/854200#M37612</link>
      <description>Try PROC TRANSPOSE</description>
      <pubDate>Tue, 17 Jan 2023 21:12:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/create-categorical-variables-from-several-dates-variable/m-p/854200#M37612</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-01-17T21:12:38Z</dc:date>
    </item>
    <item>
      <title>Re: create categorical variables from several dates variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/create-categorical-variables-from-several-dates-variable/m-p/854231#M37620</link>
      <description>Please see below but it did not work.&lt;BR /&gt;&lt;BR /&gt;data want;&lt;BR /&gt;    set have;&lt;BR /&gt;    array dfa_fam dfa_fam1-dfa_fam50:&lt;BR /&gt;    array new new_a1-new_a50;&lt;BR /&gt;array time t1-t50;&lt;BR /&gt;    do i=1 to dim( dfa_fam);&lt;BR /&gt;        if not missing(dfa_fam(i)) then new(i)=1;&lt;BR /&gt;        else new(i)=0;&lt;BR /&gt;        if not missing(new(i)) then time(i)=1;&lt;BR /&gt;        else time(i)=0;&lt;BR /&gt;end; &lt;BR /&gt;    drop i;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;Proc transpose data =want out =wanted;&lt;BR /&gt;by time;&lt;BR /&gt;run;</description>
      <pubDate>Tue, 17 Jan 2023 23:39:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/create-categorical-variables-from-several-dates-variable/m-p/854231#M37620</guid>
      <dc:creator>femiajumobi1</dc:creator>
      <dc:date>2023-01-17T23:39:38Z</dc:date>
    </item>
    <item>
      <title>Re: create categorical variables from several dates variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/create-categorical-variables-from-several-dates-variable/m-p/854233#M37621</link>
      <description>Which part didn't work? How did it not work?&lt;BR /&gt;&lt;BR /&gt;Rather than by time, I would expect to see the transpose use BY ID.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://stats.oarc.ucla.edu/sas/modules/how-to-reshape-data-wide-to-long-using-proc-transpose/" target="_blank"&gt;https://stats.oarc.ucla.edu/sas/modules/how-to-reshape-data-wide-to-long-using-proc-transpose/&lt;/A&gt;</description>
      <pubDate>Tue, 17 Jan 2023 23:40:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/create-categorical-variables-from-several-dates-variable/m-p/854233#M37621</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-01-17T23:40:54Z</dc:date>
    </item>
    <item>
      <title>Re: create categorical variables from several dates variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/create-categorical-variables-from-several-dates-variable/m-p/854299#M37631</link>
      <description>&lt;P&gt;From now on, please put code in a code box, by clicking on the "little running man" icon and pasting your code into the window that appears. Then it looks like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have;
array dfa_fam dfa_fam1-dfa_fam50:
array new new_a1-new_a50;
array time t1-t50;
do i=1 to dim( dfa_fam);
if not missing(dfa_fam(i)) then new(i)=1;
else new(i)=0;
if not missing(new(i)) then time(i)=1;
else time(i)=0;
end;
drop i;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You said you wanted code like this for all 50 variables&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;New=New_A3; time=2; output;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There's no need (if I am understanding you properly) to have an array for TIME, time is just a single variable not an array. So, I would do this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have;
array dfa_fam dfa_fam1-dfa_fam50:
array new new_a1-new_a50;
array time t1-t50;
do i=1 to dim( dfa_fam);
if not missing(dfa_fam(i)) then new(i)=1;
else new(i)=0;
if new(i)&amp;gt;0 then do;
     time=i-1;
     new=new(i);
     output;
end;
drop i;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The new code assigns the value of i-1 to variable TIME, and the value of new(i) to a variable named NEW, which seems to be what you are asking for.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The whole process could be simplified, without creating variables new_a1-new_a50, these don't seem to serve any purpose and so you could just compute them without creating these variables, just doing the calculation and using the calculation. You could also use a DROP statement to remove them from data set WANT.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2023 11:27:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/create-categorical-variables-from-several-dates-variable/m-p/854299#M37631</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-01-18T11:27:48Z</dc:date>
    </item>
    <item>
      <title>Re: create categorical variables from several dates variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/create-categorical-variables-from-several-dates-variable/m-p/854326#M37635</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have;
array dfa_fam dfa_fam1-dfa_fam50:
array new new_a1-new_a50;
do i=1 to dim( dfa_fam);
if not missing(dfa_fam(i)) then new(i)=1;
else new(i)=0;
if new(i)&amp;gt;0 then do;
     time=i-1;
     new=new(i);
     output;
end;
end;
drop i;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;thanks, back to square one. ERROR message: Mixing of implicit and explicit arrays is not allowed.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2023 14:20:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/create-categorical-variables-from-several-dates-variable/m-p/854326#M37635</guid>
      <dc:creator>femiajumobi1</dc:creator>
      <dc:date>2023-01-18T14:20:00Z</dc:date>
    </item>
    <item>
      <title>Re: create categorical variables from several dates variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/create-categorical-variables-from-several-dates-variable/m-p/854328#M37636</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;I want to ensure time is reflected in a longitudinal format, wouldn't I need to have an array? Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2023 14:22:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/create-categorical-variables-from-several-dates-variable/m-p/854328#M37636</guid>
      <dc:creator>femiajumobi1</dc:creator>
      <dc:date>2023-01-18T14:22:17Z</dc:date>
    </item>
    <item>
      <title>Re: create categorical variables from several dates variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/create-categorical-variables-from-several-dates-variable/m-p/854329#M37637</link>
      <description>&lt;P&gt;Please show me the actual log, all of the log for this data step, meaning I want to see every single line and every single character in the log for this data step. Please copy the log as text and paste it into the window that appears when you click on the &amp;lt;/&amp;gt; icon.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Insert Log Icon in SAS Communities.png" style="width: 859px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/66171iFEC370B1DBF07B28/image-size/large?v=v2&amp;amp;px=999" role="button" title="Insert Log Icon in SAS Communities.png" alt="Insert Log Icon in SAS Communities.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From now on, please provide the log this way EVERY time there are errors or other problems in the log.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2023 14:23:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/create-categorical-variables-from-several-dates-variable/m-p/854329#M37637</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-01-18T14:23:07Z</dc:date>
    </item>
    <item>
      <title>Re: create categorical variables from several dates variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/create-categorical-variables-from-several-dates-variable/m-p/854331#M37638</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/436402"&gt;@femiajumobi1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;I want to ensure time is reflected in a longitudinal format, wouldn't I need to have an array? Thanks.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I don't know what you need. Your original post indicated that TIME was a single variable.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2023 14:24:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/create-categorical-variables-from-several-dates-variable/m-p/854331#M37638</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-01-18T14:24:01Z</dc:date>
    </item>
    <item>
      <title>Re: create categorical variables from several dates variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/create-categorical-variables-from-several-dates-variable/m-p/854332#M37639</link>
      <description>&lt;PRE&gt;data want;
set have;
array dfa_fam dfa_fam1-dfa_fam50:
array new new_a1-new_a50;
do i=1 to dim( dfa_fam);
if not missing(dfa_fam(i)) then new(i)=1;
else new(i)=0;
if new(i)&amp;gt;0 then do;
     time=i-1;
     new=new(i);
     output;
end;
end;
drop i;
run;&lt;/PRE&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;Here is the log of the code. Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2023 14:26:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/create-categorical-variables-from-several-dates-variable/m-p/854332#M37639</guid>
      <dc:creator>femiajumobi1</dc:creator>
      <dc:date>2023-01-18T14:26:18Z</dc:date>
    </item>
    <item>
      <title>Re: create categorical variables from several dates variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/create-categorical-variables-from-several-dates-variable/m-p/854333#M37640</link>
      <description>&lt;P&gt;This is not the log.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2023 14:26:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/create-categorical-variables-from-several-dates-variable/m-p/854333#M37640</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-01-18T14:26:50Z</dc:date>
    </item>
    <item>
      <title>Re: create categorical variables from several dates variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/create-categorical-variables-from-several-dates-variable/m-p/854336#M37641</link>
      <description>&lt;P&gt;&lt;STRONG&gt;A.&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;I have this data (short) with 50 date variables DFS_Fam1 - DFS_Fam50. Some observations do not have date value for&amp;nbsp;DFS_Fam1 - DFS_Fam50&lt;/P&gt;
&lt;P&gt;I want to create variables that show if a date value is available, it is indicated as 1, and no date value = 0 or missing.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ID&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DFS_Fam1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;DFS_Fam2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;DFS_Fam3&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 01/01/2023&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 02/01/2023&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;03/01/2023&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 04/01/2023&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 05/01/2023&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;06/01/2023&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 05/01/2023&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example for observation 1, if DFS_Fam1,&amp;nbsp;DFS_Fam2,&amp;nbsp;DFS_Fam3 have date values, then New_A1=1,&amp;nbsp;New_A2=1,&amp;nbsp;New_A3=1 as shown (but up to whenever&amp;nbsp;DFS_Fam has dates)&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ID&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DFS_Fam1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;DFS_Fam2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;DFS_Fam3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; New_A1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;New_A2&amp;nbsp; &amp;nbsp;New_A3&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 01/01/2023&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 02/01/2023&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;03/01/2023&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 04/01/2023&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 05/01/2023&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;06/01/2023&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 05/01/2023&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is clinical data, everyone has DFS_Fam1 but not necessary&amp;nbsp;&amp;nbsp;DFS_Fam2 ,&amp;nbsp;&amp;nbsp;DFS_Fam3 up to&amp;nbsp;&amp;nbsp;DFS_Fam50, thus there would be missing dates.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How do I go about these without writing 50 lines of code?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;B. I would like to convert New_A to time points&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Data&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;long;&lt;/P&gt;
&lt;P&gt;set short;&lt;/P&gt;
&lt;P&gt;New=New_A1; time=&lt;STRONG&gt;0&lt;/STRONG&gt;; output;&lt;/P&gt;
&lt;P&gt;New=New_A2; time=&lt;STRONG&gt;1&lt;/STRONG&gt;; output;&lt;/P&gt;
&lt;P&gt;New=New_A3; time=2; output;&lt;/P&gt;
&lt;P&gt;...&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ....&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .........&amp;nbsp; &amp;nbsp; &amp;nbsp;.......&lt;/P&gt;
&lt;P&gt;New=New_A50; time=50; output;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How do I go about these without writing 50 lines of code?&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;
&lt;PRE&gt;data want;
    set have;
    array dfs dfs_:
    array new new_a1-new_a50;
    do i=1 to dim(dfs);
        if not missing(dfs(i)) then new(i)=1;
        else new(i)=0;
    end;
    drop i;
run;&lt;/PRE&gt;
&lt;PRE&gt;data want;
    set have;
    array dfs dfs_:
    array new new_a1-new_a50;
    do i=1 to dim(dfs);
        if not missing(dfs(i)) then new(i)=1;
        else new(i)=0;
    end;
    drop i;
run;&lt;/PRE&gt;
&lt;PRE&gt;data want;
set have;
array dfa_fam dfa_fam1-dfa_fam50:
array new new_a1-new_a50;
array time t1-t50;
do i=1 to dim( dfa_fam);
if not missing(dfa_fam(i)) then new(i)=1;
else new(i)=0;
if not missing(new(i)) then time(i)=1;
else time(i)=0;
end;
drop i;
run;

Proc transpose data =want out =wanted;
by time;
run;&lt;/PRE&gt;
&lt;PRE&gt;data want;
set have;
array dfa_fam dfa_fam1-dfa_fam50:
array new new_a1-new_a50;
array time t1-t50;
do i=1 to dim( dfa_fam);
if not missing(dfa_fam(i)) then new(i)=1;
else new(i)=0;
if not missing(new(i)) then time(i)=1;
else time(i)=0;
end;
drop i;
run;&lt;/PRE&gt;
&lt;PRE&gt;data want;
set have;
array dfa_fam dfa_fam1-dfa_fam50:
array new new_a1-new_a50;
array time t1-t50;
do i=1 to dim( dfa_fam);
if not missing(dfa_fam(i)) then new(i)=1;
else new(i)=0;
if new(i)&amp;gt;0 then do;
     time=i-1;
     new=new(i);
     output;
end;
drop i;
run;&lt;/PRE&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;here is the list of data steps as per our communication. Thanks.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2023 14:33:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/create-categorical-variables-from-several-dates-variable/m-p/854336#M37641</guid>
      <dc:creator>femiajumobi1</dc:creator>
      <dc:date>2023-01-18T14:33:15Z</dc:date>
    </item>
    <item>
      <title>Re: create categorical variables from several dates variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/create-categorical-variables-from-several-dates-variable/m-p/854337#M37642</link>
      <description>&lt;P&gt;You have not provided the log.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2023 14:35:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/create-categorical-variables-from-several-dates-variable/m-p/854337#M37642</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-01-18T14:35:01Z</dc:date>
    </item>
    <item>
      <title>Re: create categorical variables from several dates variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/create-categorical-variables-from-several-dates-variable/m-p/854345#M37643</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="femiajumobi1_0-1674053577933.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/79484i36886135C8642BA9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="femiajumobi1_0-1674053577933.png" alt="femiajumobi1_0-1674053577933.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2023 14:53:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/create-categorical-variables-from-several-dates-variable/m-p/854345#M37643</guid>
      <dc:creator>femiajumobi1</dc:creator>
      <dc:date>2023-01-18T14:53:16Z</dc:date>
    </item>
  </channel>
</rss>

