<?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: Question about Arrays in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Question-about-Arrays/m-p/950806#M371767</link>
    <description>&lt;P&gt;Your code cannot work as is because you did not code the ARRAY statements properly, but I don't think that is your actual question.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you explain (and example will help) with what you want to do with your new indicator variables?&lt;/P&gt;
&lt;P&gt;I suspect what you want is to set say&amp;nbsp;DEPRESSION_MEDPAR&amp;nbsp; to 1 when there is an ICD code in the&amp;nbsp;DGNS array that indicates depression.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So first set them all to FALSE and then loop over your DX array setting them to TRUE when the code matches.&lt;/P&gt;
&lt;P&gt;So let's assume your codes exist in variables named DX1 to DX50.&amp;nbsp; So here is example for how to create DEPRESSION and STROKE binary indicator variables.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
* Read in data ;
  set have;
* Create array pointing to variables with patients ICD codes ;
  array dx dx1-dx50;
* Create temporary codes with lists of code per condition ;
  array _depression[2] $8 _temporary_ ('code1' 'code2' );
  array _stroke[3] $8 _temporary_ ('code3' 'code4' 'code5');
* Set condition flags to false;
  depression=0;
  stroke=0;
* Loop over all DX codes. Set flags true when current dx code is in the list for that condition ;
  do i=1 to dim(dx);
    if not missing(dx[i]) then do;
      if dx[i] in _depression then depression=1;
      if dx[i] in _stroke then stroke=1;
    end;
  end;
  drop i;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your ARRAY definitions should look like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;array depression_codes[50] $8 _temporary_ ('code1' 'code2' .... );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Where you have at most 50 quoted strings inside of the ( )'s.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 14 Nov 2024 17:02:22 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2024-11-14T17:02:22Z</dc:date>
    <item>
      <title>Question about Arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-Arrays/m-p/950782#M371758</link>
      <description>&lt;P&gt;Hello, I have a quick question, if I have an array defined below like array_1 and I have a second array constructed from 25 variables, can I use the&amp;nbsp; in operator to search for elements in the manner below? thank you&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if (DGNS[i]) in array_1 then indicator_variable =1&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;array_1 = ("abc", "cfr", "ser");&amp;nbsp;&lt;/P&gt;&lt;P&gt;DGNS[25] DGNS_1_CD-DGNS_25_CD;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2024 14:42:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-Arrays/m-p/950782#M371758</guid>
      <dc:creator>LuisMijares</dc:creator>
      <dc:date>2024-11-14T14:42:21Z</dc:date>
    </item>
    <item>
      <title>Re: Question about Arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-Arrays/m-p/950792#M371761</link>
      <description>&lt;P&gt;Not quite that way. SAS has set up the IN operator to want values not variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However there are two functions, WHICHN and WHICHC, N for numeric and C for character values that will search for one value in a list that can be an array.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is not an array: array_1 = ("abc", "cfr", "ser");&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That is a syntax error.&lt;/P&gt;
&lt;P&gt;To assign values to an array like that would look like:&lt;/P&gt;
&lt;PRE&gt;array array_1 (3) $ 3 ('abc', 'cfr','ser');&lt;/PRE&gt;
&lt;P&gt;Which says make an array with 3 elements, the values will be character of length 3 characters and then the list initiates the values in the array. If you don't need the variables that will be created (array_11, array_12 and array_13) after the data step ends you can make the array _temporary_.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then to search for an element of the array DGNS the syntax would be&lt;/P&gt;
&lt;PRE&gt;if Whichc(DGNS[i],of array_1(*)) &amp;gt; 0 then &amp;lt;do whatever when found&amp;gt;;&lt;/PRE&gt;
&lt;P&gt;The Which functions return the position of a value found in a list of values, the array_1 in this case, so a value greater than 0 indicates it is found,&amp;nbsp; otherwise the function returns 0.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that these will be comparisons of equality, so if the value of DGNS[1] is 'abcd' it will not match 'abc',&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2024 15:20:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-Arrays/m-p/950792#M371761</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-11-14T15:20:09Z</dc:date>
    </item>
    <item>
      <title>Re: Question about Arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-Arrays/m-p/950800#M371764</link>
      <description>&lt;P&gt;Hello, one more question, to elaborate I have this problem,&amp;nbsp; I want to find instances of ICD-10, medical codes in the the variables DGNS_1_CD-DGNS_25_CD;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I made the following arrays, not exhaustive. I want to acomplish three things, 1. I want to create indicator variables for each disease, so a depression_indicator, nonalzhimers_indicator, etc, I want to make sure the codes for the other diseaseas are assigned 0, so in the depression_indicator codes for nonalzhimers, alzhimers and pneimonia will be 0 and I want to assign -1 to codes that I don't know, there might be codes for diseases that are not listed in the. I was trying to use the following code, any ideas would be helpful&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;array DGNS $ DGNS_1_CD -- DGNS_25_CD;&lt;BR /&gt;DEPRESSION_MEDPAR = .;&lt;BR /&gt;NONALZH_DEMEN_MEDPAR = .;&lt;BR /&gt;ALZH_MEDPAR = .;&lt;BR /&gt;PNEUMO_MEDPAR = .;&lt;BR /&gt;hf_medpar = .;&lt;/P&gt;&lt;P&gt;array depression_codes[50] $8 _temporary_&amp;nbsp;&lt;/P&gt;&lt;P&gt;array nonalzhimers_codes[84] $8 _temporary_&amp;nbsp;&lt;/P&gt;&lt;P&gt;array alzhimers_codes[4] $8 _temporary_&amp;nbsp;&lt;/P&gt;&lt;P&gt;array pneumonia_codes[93] $8 _temporary_(&amp;nbsp;&lt;/P&gt;&lt;P&gt;do i = 1 to dim(DGNS);&lt;BR /&gt;if strip(DGNS[i]) in depression_codes then DEPRESSION_MEDPAR=1;&lt;BR /&gt;* this would find the other codes and set equal to 0;&lt;/P&gt;&lt;P&gt;if (strip(DGNS[i]) in nonalzhimers_codes or strip(DGNS[i]) in pneumonia_codes or strip(DGNS[i]) in hf_codes&lt;BR /&gt;or strip(DGNS[i]) in prknsn_codes or strip(DGNS[i]) in stroke_codes&lt;BR /&gt;or strip(DGNS[i]) in stroke_exclusion_codes or strip(DGNS[i]) in anxiety_codes&lt;BR /&gt;or strip(DGNS[i]) in bipolar_codes or strip(DGNS[i]) in TBI_codes&lt;BR /&gt;or strip(DGNS[i]) in DRUG_USE_CODES or strip(DGNS[i]) in PSYCH_CODES&lt;BR /&gt;or strip(DGNS[i]) in OUD_CODES) then DEPRESSION_MEDPAR = 0;*/&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2024 16:08:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-Arrays/m-p/950800#M371764</guid>
      <dc:creator>LuisMijares</dc:creator>
      <dc:date>2024-11-14T16:08:27Z</dc:date>
    </item>
    <item>
      <title>Re: Question about Arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-Arrays/m-p/950802#M371766</link>
      <description>&lt;P&gt;There is an IN ARRAY syntax.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;49         data _null_;
50            array array_1 [3] $ 3 ('abc', 'cfr','ser');
51            diag = 'cfr';
52            if diag in array_1 then do;
53               found = 1;
54               put _all_;
55               end;
56            run;

array_11=abc array_12=cfr array_13=ser diag=cfr found=1 _ERROR_=0 _N_=1&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 14 Nov 2024 16:33:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-Arrays/m-p/950802#M371766</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2024-11-14T16:33:56Z</dc:date>
    </item>
    <item>
      <title>Re: Question about Arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-Arrays/m-p/950806#M371767</link>
      <description>&lt;P&gt;Your code cannot work as is because you did not code the ARRAY statements properly, but I don't think that is your actual question.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you explain (and example will help) with what you want to do with your new indicator variables?&lt;/P&gt;
&lt;P&gt;I suspect what you want is to set say&amp;nbsp;DEPRESSION_MEDPAR&amp;nbsp; to 1 when there is an ICD code in the&amp;nbsp;DGNS array that indicates depression.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So first set them all to FALSE and then loop over your DX array setting them to TRUE when the code matches.&lt;/P&gt;
&lt;P&gt;So let's assume your codes exist in variables named DX1 to DX50.&amp;nbsp; So here is example for how to create DEPRESSION and STROKE binary indicator variables.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
* Read in data ;
  set have;
* Create array pointing to variables with patients ICD codes ;
  array dx dx1-dx50;
* Create temporary codes with lists of code per condition ;
  array _depression[2] $8 _temporary_ ('code1' 'code2' );
  array _stroke[3] $8 _temporary_ ('code3' 'code4' 'code5');
* Set condition flags to false;
  depression=0;
  stroke=0;
* Loop over all DX codes. Set flags true when current dx code is in the list for that condition ;
  do i=1 to dim(dx);
    if not missing(dx[i]) then do;
      if dx[i] in _depression then depression=1;
      if dx[i] in _stroke then stroke=1;
    end;
  end;
  drop i;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your ARRAY definitions should look like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;array depression_codes[50] $8 _temporary_ ('code1' 'code2' .... );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Where you have at most 50 quoted strings inside of the ( )'s.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2024 17:02:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-Arrays/m-p/950806#M371767</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-11-14T17:02:22Z</dc:date>
    </item>
    <item>
      <title>Re: Question about Arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-Arrays/m-p/950811#M371770</link>
      <description>&lt;P&gt;Yes, for example the indicator variable Depression_indicator should equal 1 when any of the codes in the DGNS_1_CD-DGNS_25_CD are equal to the codes in the depresion array, I also want it to equal 0 when there are codes for the other illnesses, so if there are codes for anxiety, alzhimers, pneumonia then the Depression_indicator should be equal to 0, if there are codes that I don't know about that are not codes in the alzhimers, pneumonia, depression, arrays then they should be -1.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2024 17:12:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-Arrays/m-p/950811#M371770</guid>
      <dc:creator>LuisMijares</dc:creator>
      <dc:date>2024-11-14T17:12:49Z</dc:date>
    </item>
    <item>
      <title>Re: Question about Arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-Arrays/m-p/950813#M371772</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/423175"&gt;@LuisMijares&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Yes, for example the indicator variable Depression_indicator should equal 1 when any of the codes in the DGNS_1_CD-DGNS_25_CD are equal to the codes in the depresion array, I also want it to equal 0 when there are codes for the other illnesses, so if there are codes for anxiety, alzhimers, pneumonia then the Depression_indicator should be equal to 0, if there are codes that I don't know about that are not codes in the alzhimers, pneumonia, depression, arrays then they should be -1.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Still does not make any sense. Why would having ANXIETY mean they do not also have DEPRESSION for example.&amp;nbsp; The comorbidity rates of those two conditions should actually be relatively high.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Provide a few example subjects and explain what you want to happen.&amp;nbsp; Just use a few observations and few collected DX codes and a few codes for each condition.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2024 17:20:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-Arrays/m-p/950813#M371772</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-11-14T17:20:55Z</dc:date>
    </item>
    <item>
      <title>Re: Question about Arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-Arrays/m-p/950816#M371773</link>
      <description>&lt;P&gt;well there would be two variables a DEPRESSION_indicator and a Anxiety_indicator the depression_indicator will be 1 if there is a depression code in the DGNS_1_CD-DGNS_25_CD variables and the Anxiety_indicator will be 1 if there are anxiety codes, a patient with anxiety and depression would just have the varibales Depression_indicator == 1 and Anxiety_indicator =-1;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this makes sense&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2024 17:28:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-Arrays/m-p/950816#M371773</guid>
      <dc:creator>LuisMijares</dc:creator>
      <dc:date>2024-11-14T17:28:08Z</dc:date>
    </item>
    <item>
      <title>Re: Question about Arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-Arrays/m-p/950818#M371774</link>
      <description>&lt;P&gt;this is what I was thinking of doing, I was just wondering if it was possible to use the in function on an array called depression_codes&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2024 17:29:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-Arrays/m-p/950818#M371774</guid>
      <dc:creator>LuisMijares</dc:creator>
      <dc:date>2024-11-14T17:29:21Z</dc:date>
    </item>
    <item>
      <title>Re: Question about Arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-Arrays/m-p/950819#M371775</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/423175"&gt;@LuisMijares&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;well there would be two variables a DEPRESSION_indicator and a Anxiety_indicator the depression_indicator will be 1 if there is a depression code in the DGNS_1_CD-DGNS_25_CD variables and the Anxiety_indicator will be 1 if there are anxiety codes, a patient with anxiety and depression would just have the varibales Depression_indicator == 1 and Anxiety_indicator =-1;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this makes sense&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;So it does not make any medical sense, but if you want to implement that then do it AFTER you have created the flags.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if depression=1 and anxiety=1 then anxiety=-1;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 14 Nov 2024 17:33:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-Arrays/m-p/950819#M371775</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-11-14T17:33:18Z</dc:date>
    </item>
    <item>
      <title>Re: Question about Arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-Arrays/m-p/950820#M371776</link>
      <description>&lt;P&gt;the Depresison and Anxiety codes are mutually exclusive&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;array depression_codes[50] $8 _temporary_ ('F0631', 'F0632', 'F310', 'F3110', 'F3111', 'F3112', 'F3113',)&amp;nbsp;&lt;/P&gt;&lt;P&gt;array anxiety_codes[49] $8 _temporary_ ('F064', 'F4000', 'F4001', 'F4002',)&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if the code "F0631" is in the variables DGNS_1_CD-DGNS_25_CD then Depression_indicator should be 1 if the code is is "F064" then the Depression_indicator should be 0&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2024 17:36:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-Arrays/m-p/950820#M371776</guid>
      <dc:creator>LuisMijares</dc:creator>
      <dc:date>2024-11-14T17:36:42Z</dc:date>
    </item>
    <item>
      <title>Re: Question about Arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-Arrays/m-p/950821#M371777</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/423175"&gt;@LuisMijares&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;the Depresison and Anxiety codes are mutually exclusive&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;array depression_codes[50] $8 _temporary_ ('F0631', 'F0632', 'F310', 'F3110', 'F3111', 'F3112', 'F3113',)&amp;nbsp;&lt;/P&gt;
&lt;P&gt;array anxiety_codes[49] $8 _temporary_ ('F064', 'F4000', 'F4001', 'F4002',)&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if the code "F0631" is in the variables DGNS_1_CD-DGNS_25_CD then Depression_indicator should be 1 if the code is is "F064" then the Depression_indicator should be 0&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Of course the groups of codes that indicate an condition are different.&lt;/P&gt;
&lt;P&gt;But you indicated that each observation had up to 50 different DX codes.&amp;nbsp; So some of them could indicated depression and others indicate anxiety.&amp;nbsp; Example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
   length id dx1-dx5 $8 ;
   input id dx1-dx5 ;
cards;
1 F0631 F064 . . .
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;How to you want your new variables set in that case?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2024 17:41:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-Arrays/m-p/950821#M371777</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-11-14T17:41:10Z</dc:date>
    </item>
    <item>
      <title>Re: Question about Arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-Arrays/m-p/950824#M371779</link>
      <description>&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ID&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;dx1&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;dx2&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Depression_indicator&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Anxiety indicator&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;F0631&lt;/TD&gt;&lt;TD&gt;F064&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;F0631&lt;/TD&gt;&lt;TD&gt;F064&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;F064&lt;/TD&gt;&lt;TD&gt;F067&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;-1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;f064&lt;/TD&gt;&lt;TD&gt;F0631&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this is what I had in mind, for example the code "F0671" is not a known code so the anxiety indicator should indicate -1.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2024 17:52:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-Arrays/m-p/950824#M371779</guid>
      <dc:creator>LuisMijares</dc:creator>
      <dc:date>2024-11-14T17:52:13Z</dc:date>
    </item>
    <item>
      <title>Re: Question about Arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-Arrays/m-p/950826#M371781</link>
      <description>&lt;P&gt;Still makes no sense.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the goal is to treat having depression as more important then having anxiety then make those decisions after you have checked all of the DX codes and generated your depression and anxiety indicator variables.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2024 18:02:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-Arrays/m-p/950826#M371781</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-11-14T18:02:37Z</dc:date>
    </item>
    <item>
      <title>Re: Question about Arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-Arrays/m-p/950827#M371782</link>
      <description>&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ID&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;dx1&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;dx2&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Depression_indicator&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Anxiety indicator&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;F0631&lt;/TD&gt;&lt;TD&gt;F064&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;F0631&lt;/TD&gt;&lt;TD&gt;F064&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;F064&lt;/TD&gt;&lt;TD&gt;F067&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;-1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;f064&lt;/TD&gt;&lt;TD&gt;F0631&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just want an indicator variable, this is just an example, code "F0631" indicates depression code "F064" indicates anxiety. I want to make each indicator variable 1, if the code is their respective illness, 1 if depression for example, 0 if other code, and -1 if the code is unknown.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2024 18:11:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-Arrays/m-p/950827#M371782</guid>
      <dc:creator>LuisMijares</dc:creator>
      <dc:date>2024-11-14T18:11:23Z</dc:date>
    </item>
    <item>
      <title>Re: Question about Arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-about-Arrays/m-p/950840#M371784</link>
      <description>&lt;P&gt;Just to clarify something that was said further up, you can in check for the presence of an array value in another array (though it's correct that the way you specified 'array_1` was a syntax error.&amp;nbsp; For example, this works fine:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
array c {3} $5 _temporary_ ('dm', 'chf', 'ami');
length dx1-dx5 $5;
array d {*} dx:;
dx3='chf';
inC=(d[3] in c);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;...the above produces a value of 1 for the variable 'inC', i.e., true.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2024 18:56:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-about-Arrays/m-p/950840#M371784</guid>
      <dc:creator>quickbluefish</dc:creator>
      <dc:date>2024-11-14T18:56:46Z</dc:date>
    </item>
  </channel>
</rss>

