<?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 How to create a smaller data file choosing variables and conditions in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-smaller-data-file-choosing-variables-and/m-p/517224#M139786</link>
    <description>&lt;P&gt;I need to be able to create a smaller data file that would only have the variables when they were answered&amp;nbsp; yes (1) and then be able to also select only the date variables that would be linked to them.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a file with 200 observations and 300 variables and I only need the following variables:&lt;/P&gt;&lt;P&gt;X (25 variables X)&amp;nbsp;&lt;/P&gt;&lt;P&gt;Y (25 variables Y)&lt;/P&gt;&lt;P&gt;these are the ones I should only have in my data set - but only&amp;nbsp; if they were answered YES - in this data file no = 0.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and Date variables (25 variables) that would match the yes, let's call them dtevar&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example X1 and Y1 both have a corresponding (and the same) date variable&amp;nbsp; dtevar1 , X2 and Y2 both have dtevar2 etc.&lt;/P&gt;&lt;P&gt;but if I don't select only the variables that are yes (1) I end up with a lot of dates I do not need.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I thought of doing an array but nothing I am trying to do works. I would really appreciate if anyone could help me figure out&amp;nbsp;how to work with this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance.&lt;/P&gt;</description>
    <pubDate>Thu, 29 Nov 2018 20:23:58 GMT</pubDate>
    <dc:creator>Mscarboncopy</dc:creator>
    <dc:date>2018-11-29T20:23:58Z</dc:date>
    <item>
      <title>How to create a smaller data file choosing variables and conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-smaller-data-file-choosing-variables-and/m-p/517224#M139786</link>
      <description>&lt;P&gt;I need to be able to create a smaller data file that would only have the variables when they were answered&amp;nbsp; yes (1) and then be able to also select only the date variables that would be linked to them.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a file with 200 observations and 300 variables and I only need the following variables:&lt;/P&gt;&lt;P&gt;X (25 variables X)&amp;nbsp;&lt;/P&gt;&lt;P&gt;Y (25 variables Y)&lt;/P&gt;&lt;P&gt;these are the ones I should only have in my data set - but only&amp;nbsp; if they were answered YES - in this data file no = 0.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and Date variables (25 variables) that would match the yes, let's call them dtevar&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example X1 and Y1 both have a corresponding (and the same) date variable&amp;nbsp; dtevar1 , X2 and Y2 both have dtevar2 etc.&lt;/P&gt;&lt;P&gt;but if I don't select only the variables that are yes (1) I end up with a lot of dates I do not need.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I thought of doing an array but nothing I am trying to do works. I would really appreciate if anyone could help me figure out&amp;nbsp;how to work with this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Nov 2018 20:23:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-smaller-data-file-choosing-variables-and/m-p/517224#M139786</guid>
      <dc:creator>Mscarboncopy</dc:creator>
      <dc:date>2018-11-29T20:23:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a smaller data file choosing variables and conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-smaller-data-file-choosing-variables-and/m-p/517227#M139789</link>
      <description>&lt;P&gt;I'm not sure this plan will work.&amp;nbsp; What should happen to a variable that is "yes" one one observation, but "no" on another observation?&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Whatever decision you make about a variable ... keep it or drop it ... has to apply to all the observations.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Nov 2018 20:37:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-smaller-data-file-choosing-variables-and/m-p/517227#M139789</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-11-29T20:37:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a smaller data file choosing variables and conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-smaller-data-file-choosing-variables-and/m-p/517228#M139790</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/210474"&gt;@Mscarboncopy&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I need to be able to create a smaller data file that would only have the variables when they were answered&amp;nbsp; yes (1) and then be able to also select only the date variables that would be linked to them.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a file with 200 observations and 300 variables and I only need the following variables:&lt;/P&gt;
&lt;P&gt;X (25 variables X)&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Y (25 variables Y)&lt;/P&gt;
&lt;P&gt;these are the ones I should only have in my data set - but only&amp;nbsp; if they were answered YES - in this data file no = 0.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and Date variables (25 variables) that would match the yes, let's call them dtevar&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example X1 and Y1 both have a corresponding (and the same) date variable&amp;nbsp; dtevar1 , X2 and Y2 both have dtevar2 etc.&lt;/P&gt;
&lt;P&gt;but if I don't select only the variables that are yes (1) I end up with a lot of dates I do not need.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I thought of doing an array but nothing I am trying to do works. I would really appreciate if anyone could help me figure out&amp;nbsp;how to work with this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you in advance.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Your description is tad confusing and it isn't clear if you want 1) all of the x variables to be "yes" 2) at least one of the x variables to be 'yes'.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you can provide an example of your data, perhaps with 5 instead of 25 "variables x" and "variables y", including the actual names of variables with maybe 10 or fifteen records and what the result should be you my get a better answer. Your example data should include some where the observation is not included in the output.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The DROP or KEEP statements can reduce the variables but every record will have all of the variables kept.&lt;/P&gt;
&lt;P&gt;Data new;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set old;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; keep &amp;lt;list names of variables to keep&amp;gt;;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;for example.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Nov 2018 20:40:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-smaller-data-file-choosing-variables-and/m-p/517228#M139790</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-11-29T20:40:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a smaller data file choosing variables and conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-smaller-data-file-choosing-variables-and/m-p/517286#M139817</link>
      <description>&lt;P&gt;Thank you. Yes that is my issue... I use the keep statement often, to create subsets, but this time I need to be able to select only the variables that have at least 1 yes for 1 ID. This is because of the 25 variables I mentioned we don't get a lot in the beginning so say from X1 to X10 I might not get any Yes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example pretend my data file has only 6 obs (A-F) and 5 Vars (X1-X5)&lt;/P&gt;&lt;P&gt;OBS &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; X1&amp;nbsp; X2 X3 X4 X5&lt;/P&gt;&lt;P&gt;A&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; 0&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&lt;/P&gt;&lt;P&gt;B&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; 0&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;BR /&gt;C&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; 0&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&lt;BR /&gt;D&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; 0 &amp;nbsp;&amp;nbsp;&amp;nbsp; 0 &amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;BR /&gt;E&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; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 &amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;BR /&gt;F&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; 0&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so the code would somehow get rid of X3 because X3 did not get any yes, It would keep X1 X2 X4 and X5 and then also get rid of dtevar3.&lt;/P&gt;&lt;P&gt;Or is there a way to create a table maybe ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;FREQ DATA = datasetname;&lt;/P&gt;&lt;P&gt;TABLES X1/dtevar1;&lt;/P&gt;&lt;P&gt;WHERE X1 =1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would that work ? I have not worked with Where statements much.&lt;/P&gt;&lt;P&gt;If this works, how could I create a statement that would allow me to run all of the X variables at once and not have a FREQ statement for each variable ?&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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Nov 2018 22:30:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-smaller-data-file-choosing-variables-and/m-p/517286#M139817</guid>
      <dc:creator>Mscarboncopy</dc:creator>
      <dc:date>2018-11-29T22:30:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a smaller data file choosing variables and conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-smaller-data-file-choosing-variables-and/m-p/517293#M139823</link>
      <description>&lt;P&gt;Let's see if we can agree on a simpler approach.&amp;nbsp; Don't count, instead get the mean of each X variable:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc summary data=have;&lt;/P&gt;
&lt;P&gt;var x1-x25;&lt;/P&gt;
&lt;P&gt;output out=means mean=;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That gives you a data set named MEANS, where X1 is the mean value of the original X1 variable, etc.&amp;nbsp; From that point, we're looking to remove variables (and the matching dtevar) when the mean is 0.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does that sound right?&lt;/P&gt;</description>
      <pubDate>Thu, 29 Nov 2018 22:56:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-smaller-data-file-choosing-variables-and/m-p/517293#M139823</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-11-29T22:56:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a smaller data file choosing variables and conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-smaller-data-file-choosing-variables-and/m-p/517508#M139933</link>
      <description>&lt;P&gt;Hi Astounding,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes this works ! Thank you.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now what if I needed to select variables&amp;nbsp;that were coded up to a certain age only ?&amp;nbsp;I have a&amp;nbsp; data file that has variables coded for ages 0 - 15 years.&lt;/P&gt;&lt;P&gt;I have DOB and I want the variables only before the subject turned 1 year old. How can I create a subset that only has the variables coded from 0-1 years ? Can I use the DOB for this in a data command ? I have the dates that match the variables coded as in the example above and I would only need the variables up to 1 year. However each subject has different DOB so I don't know which dates I would need to keep to make sure the data for 0-1 is used for all.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Similarly, how would I select only the most recent (independent of age)&amp;nbsp; coded if the final dates are all different for each observation ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using my variable X from the prior example: say X was a medical diagnosis such as "cold" so I now can select the times when "cold" was coded (X=1) using your suggestion in the entire data set. But now I need to know from 0-1 year only and then also know when it was the last time (in my data set) the subject had a cold.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The last dates are all different just as DOB is different.&lt;/P&gt;&lt;P&gt;Thank you again.&lt;/P&gt;&lt;P&gt;M&lt;/P&gt;</description>
      <pubDate>Fri, 30 Nov 2018 15:18:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-smaller-data-file-choosing-variables-and/m-p/517508#M139933</guid>
      <dc:creator>Mscarboncopy</dc:creator>
      <dc:date>2018-11-30T15:18:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a smaller data file choosing variables and conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-smaller-data-file-choosing-variables-and/m-p/517538#M139957</link>
      <description>&lt;P&gt;Again, this new result is problematic because you might not be able to eliminate variables.&amp;nbsp; If a single patient has all 25 values filled in before age 1, you need to keep all the variables for every patient.&amp;nbsp; SAS does not let you pick and choose which variables to keep on each observation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You might have been better advised to keep a narrow data set, with many observations per patient:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;patient, dob, age, diagnosis, date&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That would make your life a lot easier now that you are on to the analysis phase.&amp;nbsp; Because of the wide structure to your data, you will need to learn about arrays:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;set have;&lt;/P&gt;
&lt;P&gt;array diags {25} x1-x25;&lt;/P&gt;
&lt;P&gt;array dates {25} datevar1-datevar25;&lt;/P&gt;
&lt;P&gt;do k=1 to 25;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;if /* x{k} indicates a cold diagnosis */&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;and /* dates{k} indicates &amp;lt; 1 year old */&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;then earliest = max(earliest, dates{k});&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That's the idea of it, with the commented out conditions needing to be replaced with the actual logic.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Nov 2018 16:10:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-smaller-data-file-choosing-variables-and/m-p/517538#M139957</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-11-30T16:10:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a smaller data file choosing variables and conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-smaller-data-file-choosing-variables-and/m-p/519452#M140689</link>
      <description>&lt;P&gt;Hi Astounding,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry it took me awhile to get back to this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I ended up calculating my ages and I am trying an array for antibiotic use for age up to 12 months (1 year). Trying to find out which ids got antibiotic coded before age 1 year.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am running into errors and can't figure out why.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;array inage {25} VISIT1_AGE VISIT2_AGE VISIT3_AGE VISIT4_AGE VISIT5_AGE VISIT6_AGE VISIT7_AGE VISIT8_AGE VISIT9_AGE VISIT10_AGE VISIT11_AGE&lt;BR /&gt;VISIT12_AGE VISIT13_AGE VISIT14_AGE VISIT15_AGE VISIT16_AGE VISIT17_AGE VISIT18_AGE VISIT19_AGE VISIT20_AGE VISIT21_AGE VISIT22_AGE VISIT23_AGE VISIT24_AGE VISIT25;&lt;BR /&gt;array incode {25} antibi1 antibi2 antibi3 antibi4 antibi5 antibi6 antibi7 antibi8 antibi9 antibi10 antibi11 antibi12 antibi13 antibi14 antibi15 antibi16&lt;BR /&gt;antibi17 antibi18 antibi19 antibi20 antibi21 antibi22 antibi23 antibi24 antibi25;&lt;BR /&gt;array outage {25} outVISIT1_AGE -- outVISIT25_AGE ;&lt;BR /&gt;array outcode {25} outantibi1--outantibi25;&lt;BR /&gt;j = 1;&lt;/P&gt;&lt;P&gt;do i = 1 to 25;&lt;BR /&gt;if (. &amp;lt; inage{i} le age1) and incode{i} in('antibi1' 'antibi2' 'antibi3' 'antibi4' 'antibi5' 'antibi6' 'antibi7'&lt;BR /&gt;'antibi8' 'antibi9' 'antibi10' 'antibi11' 'antibi12' 'antibi13' 'antibi14' 'antibi15' 'antibi16' 'antibi17'&lt;BR /&gt;'antibi18' 'antibi19' 'antibi20' 'antibi21' 'antibi22' 'antibi23' 'antibi24' 'antibi25') then do; /* if age is not missing and in time frame and you have one or more of the asthma codes */&lt;BR /&gt;outage{j} = inage{i}; /* move image to outage */&lt;BR /&gt;outcode{j} = 1; /* found antibi code and in time range*/&lt;BR /&gt;j = j + 1; /* when you find one then increment the j index */&lt;BR /&gt;end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;These are the errors&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;ERROR: Variable outVISIT1_AGE cannot be found on the list of previously defined variables.&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;ERROR: Too few variables defined for the dimension(s) specified for the array outage.&lt;/STRONG&gt;&lt;BR /&gt;197 array inage {25} VISIT1_AGE VISIT2_AGE VISIT3_AGE VISIT4_AGE VISIT5_AGE VISIT6_AGE VISIT7_AGE&lt;BR /&gt;-----&lt;BR /&gt;124&lt;BR /&gt;197! VISIT8_AGE VISIT9_AGE VISIT10_AGE VISIT11_AGE&lt;BR /&gt;&lt;STRONG&gt;ERROR: Variable outantibi1 cannot be found on the list of previously defined variables.&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;ERROR: Too few variables defined for the dimension(s) specified for the array outcode.&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;ERROR 124-185: The variable inage has already been defined.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;198 VISIT12_AGE VISIT13_AGE VISIT14_AGE VISIT15_AGE VISIT16_AGE VISIT17_AGE VISIT18_AGE&lt;BR /&gt;198! VISIT19_AGE VISIT20_AGE VISIT21_AGE VISIT22_AGE VISIT23_AGE VISIT24_AGE VISIT25;&lt;BR /&gt;199 array incode {25} antibi1 antibi2 antibi3 antibi4 antibi5 antibi6 antibi7 antibi8 antibi9&lt;BR /&gt;------&lt;BR /&gt;124&lt;BR /&gt;199! antibi10 antibi11 antibi12 antibi13 antibi14 antibi15 antibi16&lt;BR /&gt;&lt;STRONG&gt;ERROR 124-185: The variable incode has already been defined.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;200 antibi17 antibi18 antibi19 antibi20 antibi21 antibi22 antibi23 antibi24 antibi25;&lt;BR /&gt;201 array outage {25} outVISIT1_AGE -- outVISIT25_AGE ;&lt;BR /&gt;------&lt;BR /&gt;124&lt;BR /&gt;&lt;STRONG&gt;ERROR 124-185: The variable outage has already been defined.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;202 array outcode {25} outantibi1--outantibi25;&lt;BR /&gt;-------&lt;BR /&gt;124&lt;BR /&gt;&lt;STRONG&gt;ERROR 124-185: The variable outcode has already been defined.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;203 j = 1;&lt;BR /&gt;204&lt;BR /&gt;205 do i = 1 to 25;&lt;BR /&gt;206 if (. &amp;lt; inage{i} le age1) and incode{i} in('antibi1' 'antibi2' 'antibi3' 'antibi4'&lt;BR /&gt;206! 'antibi5' 'antibi6' 'antibi7'&lt;BR /&gt;207 'antibi8' 'antibi9' 'antibi10' 'antibi11' 'antibi12' 'antibi13' 'antibi14' 'antibi15'&lt;BR /&gt;207! 'antibi16' 'antibi17'&lt;BR /&gt;208 'antibi18' 'antibi19' 'antibi20' 'antibi21' 'antibi22' 'antibi23' 'antibi24' 'antibi25') then&lt;BR /&gt;208! do; /* if age is not missing and in time frame and you have one or more of antibi coded&lt;BR /&gt;208! */&lt;BR /&gt;209 outage{j} = inage{i}; /* move image to outage */&lt;BR /&gt;210 outcode{j} = 1; /* found antibi code and in time range*/&lt;BR /&gt;211 j = j + 1; /* when you find one then increment the j index */&lt;BR /&gt;212 end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have been trying to figure it out unsuccessfully. I appreciate any input to point me in the right direction.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you again&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Dec 2018 16:00:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-smaller-data-file-choosing-variables-and/m-p/519452#M140689</guid>
      <dc:creator>Mscarboncopy</dc:creator>
      <dc:date>2018-12-07T16:00:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a smaller data file choosing variables and conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-smaller-data-file-choosing-variables-and/m-p/519473#M140699</link>
      <description>&lt;P&gt;First, let's clear up the obvious piece.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The array statements are using&amp;nbsp; double-dash to indicate the last of variable names:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;array outage {25} outVISIT1_AGE -- outVISIT25_AGE ;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;array outcode {25} outantibi1--outantibi25;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The double-dash does not respect the numeric suffix at the end of the variable names.&amp;nbsp; You could just as easily code a list that reads cat--dog.&amp;nbsp; That would mean all variable names beginning with CAT and ending with DOG, in the order they were defined when creating the original data.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;One of the fixes is easy:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;array outcode {25} outantibi1-outantibi25;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The single dash tells SAS that the list of variable names has a numeric suffix, with the same prefix.&amp;nbsp; The other ARRAY statement is more problematic.&amp;nbsp; There isn't a numeric suffix.&amp;nbsp; To fix it, you will need to spell out the full list of 25 names:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;array outage {25} outVISIT1_AGE outVISIT2_AGE ... outVISIT24_AGE outVISIT25_AGE ;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;There just are no shortcuts available when the variable names are in this form.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;As always when debugging, we'll have to see if clearing this up resolves all the issues, or reveals additional issues.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Dec 2018 16:33:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-smaller-data-file-choosing-variables-and/m-p/519473#M140699</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-12-07T16:33:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a smaller data file choosing variables and conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-smaller-data-file-choosing-variables-and/m-p/519512#M140712</link>
      <description>&lt;P&gt;ok so when I do that this is what I get&lt;/P&gt;&lt;P&gt;array inage {25} VISIT1_AGE VISIT2_AGE VISIT3_AGE VISIT4_AGE VISIT5_AGE VISIT6_AGE VISIT7_AGE&lt;BR /&gt;-----&lt;BR /&gt;180&lt;BR /&gt;233! VISIT8_AGE VISIT9_AGE VISIT10_AGE VISIT11_AGE&lt;BR /&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/P&gt;&lt;P&gt;234 VISIT12_AGE VISIT13_AGE VISIT14_AGE VISIT15_AGE VISIT16_AGE VISIT17_AGE VISIT18_AGE&lt;BR /&gt;234! VISIT19_AGE VISIT20_AGE VISIT21_AGE VISIT22_AGE VISIT23_AGE VISIT24_AGE VISIT25;&lt;/P&gt;&lt;P&gt;235 array incode {25} antibi1 antibi2 antibi3 antibi4 antibi5 antibi6 antibi7 antibi8 antibi9&lt;BR /&gt;-----&lt;BR /&gt;180&lt;BR /&gt;235! antibi10 antibi11 antibi12 antibi13 antibi14 antibi15 antibi16&lt;BR /&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/P&gt;&lt;P&gt;236 antibi17 antibi18 antibi19 antibi20 antibi21 antibi22 antibi23 antibi24 antibi25;&lt;/P&gt;&lt;P&gt;237 array outage {25} VISIT1_AGE VISIT2_AGE VISIT3_AGE VISIT4_AGE VISIT5_AGE VISIT6_AGE&lt;BR /&gt;-----&lt;BR /&gt;180&lt;BR /&gt;237! VISIT7_AGE VISIT8_AGE VISIT9_AGE VISIT10_AGE VISIT11_AGE&lt;BR /&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/P&gt;&lt;P&gt;238 VISIT12_AGE VISIT13_AGE VISIT14_AGE VISIT15_AGE VISIT16_AGE VISIT17_AGE VISIT18_AGE&lt;BR /&gt;238! VISIT19_AGE VISIT20_AGE VISIT21_AGE VISIT22_AGE VISIT23_AGE VISIT24_AGE VISIT25;&lt;/P&gt;&lt;P&gt;239 array outcode {25} outantibi1- outantibi25;&lt;BR /&gt;-----&lt;BR /&gt;180&lt;/P&gt;&lt;P&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/P&gt;&lt;P&gt;240 j = 1;&lt;BR /&gt;-&lt;BR /&gt;180&lt;/P&gt;&lt;P&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/P&gt;&lt;P&gt;241&lt;BR /&gt;242 do i = 1 to 25;&lt;BR /&gt;--&lt;BR /&gt;180&lt;/P&gt;&lt;P&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/P&gt;&lt;P&gt;243 if (. &amp;lt; inage{i} le age1) and incode{i} in('antibi1' 'antibi2' 'antibi3' 'antibi4'&lt;BR /&gt;--&lt;BR /&gt;180&lt;BR /&gt;243! 'antibi5' 'antibi6' 'antibi7'&lt;BR /&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/P&gt;&lt;P&gt;244 'antibi8' 'antibi9' 'antibi10' 'antibi11' 'antibi12' 'antibi13' 'antibi14' 'antibi15'&lt;BR /&gt;244! 'antibi16' 'antibi17'&lt;BR /&gt;245 'antibi18' 'antibi19' 'antibi20' 'antibi21' 'antibi22' 'antibi23' 'antibi24' 'antibi25') then&lt;BR /&gt;245! do; /* if age is not missing and in time frame and you have one or more of the asthma codes&lt;/P&gt;&lt;P&gt;245! /* if age is not missing and in time frame and you have one or more of the asthma codes */&lt;BR /&gt;246 outage{j} = inage{i};&lt;BR /&gt;------&lt;BR /&gt;180&lt;/P&gt;&lt;P&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/P&gt;&lt;P&gt;247 outcode{j} = 1;&lt;BR /&gt;-------&lt;BR /&gt;180&lt;/P&gt;&lt;P&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/P&gt;&lt;P&gt;248 j = j + 1;&lt;BR /&gt;-&lt;BR /&gt;180&lt;/P&gt;&lt;P&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/P&gt;&lt;P&gt;249 end;&lt;BR /&gt;---&lt;BR /&gt;180&lt;/P&gt;&lt;P&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Dec 2018 18:50:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-smaller-data-file-choosing-variables-and/m-p/519512#M140712</guid>
      <dc:creator>Mscarboncopy</dc:creator>
      <dc:date>2018-12-07T18:50:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a smaller data file choosing variables and conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-smaller-data-file-choosing-variables-and/m-p/519521#M140715</link>
      <description>&lt;P&gt;Disregard my previous comment.&lt;/P&gt;&lt;P&gt;It worked as it showed no errors.&lt;/P&gt;&lt;P&gt;However, when I create an SPSS file this is what it says&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;age1 is uninitialized so it is creating a var age1&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;from here&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;if (. &amp;lt; inage{i}&amp;nbsp;&lt;STRONG&gt;le age1)&amp;nbsp;&lt;/STRONG&gt;and incode{i} in('antibi1' 'antibi2' 'antibi3' 'antibi4' 'antibi5' 'antibi6' 'antibi7&lt;/SPAN&gt;&lt;/DIV&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>Fri, 07 Dec 2018 19:16:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-smaller-data-file-choosing-variables-and/m-p/519521#M140715</guid>
      <dc:creator>Mscarboncopy</dc:creator>
      <dc:date>2018-12-07T19:16:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a smaller data file choosing variables and conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-smaller-data-file-choosing-variables-and/m-p/519559#M140735</link>
      <description>&lt;P&gt;So your programming depends on there being an existing variable named AGE1.&amp;nbsp; But SAS is finding that there is no such variable.&amp;nbsp; Did you mean to refer to AGE1 or did you mean to refer to something else?&lt;/P&gt;</description>
      <pubDate>Fri, 07 Dec 2018 20:59:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-smaller-data-file-choosing-variables-and/m-p/519559#M140735</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-12-07T20:59:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a smaller data file choosing variables and conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-smaller-data-file-choosing-variables-and/m-p/519565#M140739</link>
      <description>&lt;P&gt;yes I just realized that right after I&amp;nbsp; posted my last note. This is what I add to create age1&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;age1 = intnx(year,dob,1); /* add 1 year to date of birth */&lt;/P&gt;&lt;P&gt;and kept the rest of the code the same and the variables are created but all empty ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;these are new errors&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Argument 1 to function INTNX(' .',15803,1) at line 102 column 8 is invalid&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and It looks like it is only for a few ids ? but it would be able to create for others ? wouldn't it ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and at the end it says&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Mathematical operations could not be performed at the following places. The results of the&lt;BR /&gt;operations have been set to missing values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;This is what my code looks like now&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;is there anything wrong that I am missing ? Thank you for your help !&amp;nbsp;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data want;&lt;/P&gt;&lt;P&gt;Set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;age1 = intnx(year,dob,1); /* add 1 year to date of birth */&lt;/P&gt;&lt;P&gt;array inage {25} VISIT1_AGE VISIT2_AGE VISIT3_AGE VISIT4_AGE VISIT5_AGE VISIT6_AGE VISIT7_AGE VISIT8_AGE VISIT9_AGE VISIT10_AGE VISIT11_AGE&lt;BR /&gt;VISIT12_AGE VISIT13_AGE VISIT14_AGE VISIT15_AGE VISIT16_AGE VISIT17_AGE VISIT18_AGE VISIT19_AGE VISIT20_AGE VISIT21_AGE VISIT22_AGE VISIT23_AGE VISIT24_AGE VISIT25_AGE;&lt;BR /&gt;array incode {25} antibi1 antibi2 antibi3 antibi4 antibi5 antibi6 antibi7 antibi8 antibi9 antibi10 antibi11 antibi12 antibi13 antibi14 antibi15 antibi16&lt;BR /&gt;antibi17 antibi18 antibi19 antibi20 antibi21 antibi22 antibi23 antibi24 antibi25;&lt;BR /&gt;array outage {25} outVISIT1_AGE outVISIT2_AGE outVISIT3_AGE outVISIT4_AGE outVISIT5_AGE outVISIT6_AGE outVISIT7_AGE outVISIT8_AGE outVISIT9_AGE outVISIT10_AGE outVISIT11_AGE&lt;BR /&gt;VISIT12_AGE outVISIT13_AGE outVISIT14_AGE outVISIT15_AGE outVISIT16_AGE outVISIT17_AGE outVISIT18_AGE outVISIT19_AGE outVISIT20_AGE outVISIT21_AGE outVISIT22_AGE outVISIT23_AGE outVISIT24_AGE outVISIT25_AGE;&lt;BR /&gt;array outcode {25} outantibi1 - outantibi25;&lt;BR /&gt;j = 1;&lt;/P&gt;&lt;P&gt;do i = 1 to 25;&lt;BR /&gt;if (. &amp;lt; inage{i} le age1) and incode{i} in('antibi1' 'antibi2' 'antibi3' 'antibi4' 'antibi5' 'antibi6' 'antibi7'&lt;BR /&gt;'antibi8' 'antibi9' 'antibi10' 'antibi11' 'antibi12' 'antibi13' 'antibi14' 'antibi15' 'antibi16' 'antibi17'&lt;BR /&gt;'antibi18' 'antibi19' 'antibi20' 'antibi21' 'antibi22' 'antibi23' 'antibi24' 'antibi25') then do; /* if age is not missing and in time frame and you have one or more of the asthma codes */&lt;BR /&gt;outage{j} = inage{i}; /* move image to outage */&lt;BR /&gt;outcode{j} = 1; /* found antibi code and in time range*/&lt;BR /&gt;j = j + 1; /* when you find one then increment the j index */&lt;BR /&gt;end;&lt;BR /&gt;end;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Dec 2018 21:14:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-smaller-data-file-choosing-variables-and/m-p/519565#M140739</guid>
      <dc:creator>Mscarboncopy</dc:creator>
      <dc:date>2018-12-07T21:14:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a smaller data file choosing variables and conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-smaller-data-file-choosing-variables-and/m-p/519571#M140741</link>
      <description>&lt;P&gt;If you want INTNX to use the year interval, you have to put year in quotes:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;age1 = intnx("year", dob, 1);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Otherwise, SAS thinks YEAR is the name of a variable and its value contains the proper date interval.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Dec 2018 21:31:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-smaller-data-file-choosing-variables-and/m-p/519571#M140741</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-12-07T21:31:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a smaller data file choosing variables and conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-smaller-data-file-choosing-variables-and/m-p/519578#M140745</link>
      <description>&lt;P&gt;that works !! Thank you.&lt;/P&gt;&lt;P&gt;When I create the spss file age is in a weird format&amp;nbsp;16071 I am assuming sas format ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It should have been 0.1&amp;nbsp; 0.5&amp;nbsp; &amp;nbsp;0.6&amp;nbsp; etc. What to do ? format it ? how?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And all of the other outvars I am trying to create are still empty.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This error remains&amp;nbsp;Invalid numeric data, 'antibi1' , so I have to figure this one out. It is weird because I ran frequencies and the var antibi 1 is fine it is 0 and 1 like all the other ones.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Really weird but so close though.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Dec 2018 22:04:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-smaller-data-file-choosing-variables-and/m-p/519578#M140745</guid>
      <dc:creator>Mscarboncopy</dc:creator>
      <dc:date>2018-12-07T22:04:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a smaller data file choosing variables and conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-smaller-data-file-choosing-variables-and/m-p/519613#M140766</link>
      <description>&lt;P&gt;Is this AGE1 that you are talking about?&amp;nbsp; 16071 is probably the SAS equivalent of January 1 of some year.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 08 Dec 2018 00:25:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-smaller-data-file-choosing-variables-and/m-p/519613#M140766</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-12-08T00:25:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a smaller data file choosing variables and conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-smaller-data-file-choosing-variables-and/m-p/519659#M140799</link>
      <description>&lt;P&gt;Sorry this is getting to be such a long question.&lt;/P&gt;&lt;P&gt;This age1 will give me a date and I am not sure this is what I wanted to do.&lt;/P&gt;&lt;P&gt;Creating a date&amp;nbsp;for when each ID turned one does not help because I might not have that date in the visit_ages for some IDS.&lt;/P&gt;&lt;P&gt;Since we don't always have a visit for 1 year of age. Each ID has different ages, unfortunately. So if I am calculating age1 as the date for when each ID turns 1 what will happen for the IDS for which I don't have that date ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also my array is using variables VISIT_AGE not _VISIT_DATE.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do have visit dates (but I might not have that 1 year old date) and I am using age variables so wouldn't it be better - and more importantly - is there a way for me to specify the following in the array ?&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;only if visit_age =&amp;lt; 1?&lt;/DIV&gt;&lt;DIV&gt;but this would need to be for all visit_ages&amp;nbsp;Visit_age1 visit_age2 etc.&amp;nbsp;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;If I need to pull out &amp;nbsp;antibiotics coded 1 (yes) only&amp;nbsp;Up to 1 year of age and there is&amp;nbsp; way for me to specify the above in the array then&amp;nbsp;&amp;nbsp;the OUTVARS in my array would only be generated IF AND only&amp;nbsp;the ages were 1 or lower.&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The visit_ages are anywhere from 0.1 to 5.0 So the 25 visits can have a big range covered (unfortunately).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The ages are NOT the same for the visits. So Visit1_age could be 0.1 for one ID and 5.0 for another.&amp;nbsp; That is my issue with this data set.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;Creating age1 is not doing that because it is creating a DATE (correct?) and that date might not be in my visit_date variables if I don' t have a visit when the child turned 1.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I used my visit_date variables to create the visit_age variables because I thought that would be easier. But for that I need a command that would specify this in the array command I have going.&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thank you so much for your patience &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Sat, 08 Dec 2018 17:14:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-smaller-data-file-choosing-variables-and/m-p/519659#M140799</guid>
      <dc:creator>Mscarboncopy</dc:creator>
      <dc:date>2018-12-08T17:14:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a smaller data file choosing variables and conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-smaller-data-file-choosing-variables-and/m-p/519769#M140844</link>
      <description>&lt;P&gt;Since you have visit date, you could easily calculate:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;age_in_days = visit_date - dob;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That would be the age in days.&amp;nbsp; Is it important to you to determine whether a birthday has passed, so 365 days is not long enough because there might be a leap year?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Besides that, it looks like many of the remaining questions are logic ... what should happen rather than how to say it in SAS.&amp;nbsp; But I would be happy to examine questions where the logic is decided but how to say it in SAS is problematic.&lt;/P&gt;</description>
      <pubDate>Sun, 09 Dec 2018 19:46:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-smaller-data-file-choosing-variables-and/m-p/519769#M140844</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-12-09T19:46:52Z</dc:date>
    </item>
  </channel>
</rss>

