<?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 create macro variable from data field in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/create-macro-variable-from-data-field/m-p/942817#M369652</link>
    <description>&lt;P&gt;I have on the order of 60 million records, each with 12 monthly fields. I would like to accumulate counts across these fields, but their contents vary from record to record -- for example&lt;/P&gt;&lt;P&gt;id f1 f2 f3 ...&lt;/P&gt;&lt;P&gt;1 A B C&lt;/P&gt;&lt;P&gt;2 E G A&lt;/P&gt;&lt;P&gt;3 C C C&lt;/P&gt;&lt;P&gt;etc.&lt;/P&gt;&lt;P&gt;my hope was to create a series of variables called n_A, n_B, n_c, n_e, etc and then do something like&lt;/P&gt;&lt;P&gt;data counts;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set big_honker (keep=f1-f12) end=eof;&lt;/P&gt;&lt;P&gt;&amp;nbsp; array f {12} f1-f12;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do i=1 to 12;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; %let vbl=%magic(f{i});&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;amp;vbl+1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if eof then output;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; drop f1-f12;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;where the %magic takes the value &lt;EM&gt;x&lt;/EM&gt; in each of those monthly fields and creates the appropriate accumulator n_&lt;EM&gt;x&lt;/EM&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I'll be darned if I can figure it out.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Help, please!&lt;/P&gt;</description>
    <pubDate>Thu, 05 Sep 2024 21:22:16 GMT</pubDate>
    <dc:creator>dwaldo</dc:creator>
    <dc:date>2024-09-05T21:22:16Z</dc:date>
    <item>
      <title>create macro variable from data field</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-macro-variable-from-data-field/m-p/942817#M369652</link>
      <description>&lt;P&gt;I have on the order of 60 million records, each with 12 monthly fields. I would like to accumulate counts across these fields, but their contents vary from record to record -- for example&lt;/P&gt;&lt;P&gt;id f1 f2 f3 ...&lt;/P&gt;&lt;P&gt;1 A B C&lt;/P&gt;&lt;P&gt;2 E G A&lt;/P&gt;&lt;P&gt;3 C C C&lt;/P&gt;&lt;P&gt;etc.&lt;/P&gt;&lt;P&gt;my hope was to create a series of variables called n_A, n_B, n_c, n_e, etc and then do something like&lt;/P&gt;&lt;P&gt;data counts;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set big_honker (keep=f1-f12) end=eof;&lt;/P&gt;&lt;P&gt;&amp;nbsp; array f {12} f1-f12;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do i=1 to 12;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; %let vbl=%magic(f{i});&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;amp;vbl+1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if eof then output;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; drop f1-f12;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;where the %magic takes the value &lt;EM&gt;x&lt;/EM&gt; in each of those monthly fields and creates the appropriate accumulator n_&lt;EM&gt;x&lt;/EM&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I'll be darned if I can figure it out.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Help, please!&lt;/P&gt;</description>
      <pubDate>Thu, 05 Sep 2024 21:22:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-macro-variable-from-data-field/m-p/942817#M369652</guid>
      <dc:creator>dwaldo</dc:creator>
      <dc:date>2024-09-05T21:22:16Z</dc:date>
    </item>
    <item>
      <title>Re: create macro variable from data field</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-macro-variable-from-data-field/m-p/942845#M369662</link>
      <description>&lt;P&gt;There is a data step way:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  set have end=end_of_have;
  length value $10 freq 8;
  if _n_=1 then do;
    declare hash h (ordered:'a');
      h.definekey('value');
      h.definedata('value','freq');
      h.definedone();
  end;
  array month {12} f1-f12;
  do m=1 to 12;
    value=month{m};
    if h.find()^=0 then freq=1;
    else freq=freq+1;
    h.replace();
  end;
  if end_of_have then h.output(dataset:'want');
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or you could avoid constructing and using a hash.&amp;nbsp; Just pipe the data (via a data set view) to proc FREQ, and let SAS do the counting:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data vneed / view=vneed;
  set  have ;
  length value $10;
  array month{12} f1-f12 ;
  do m=1 to 12;
    value=month{m};
    output;
  end;
run;

proc freq data=vneed noprint ;
  tables value / out=want (keep=value count);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Sep 2024 03:42:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-macro-variable-from-data-field/m-p/942845#M369662</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2024-09-06T03:42:21Z</dc:date>
    </item>
    <item>
      <title>Re: create macro variable from data field</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-macro-variable-from-data-field/m-p/942854#M369663</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;H3 id="toc-hId--1542881080" class="western"&gt;Maxim 19&lt;/H3&gt;
&lt;H4 id="toc-hId--1597022104" class="maxim-western"&gt;Long beats wide.&lt;/H4&gt;
&lt;P class="remark-western"&gt;(Don't keep data in structure)&lt;/P&gt;
&lt;P class="remark-western"&gt;In the world of spreadsheets, people tend to line up data side-by-side, and put data items (dates, categories, …) into column headers. This runs counter to all the methods available in SAS for group processing, and makes programming difficult, as one has variable column names and has to resort to creating dynamic code (with macros and/or call execute) where such is not necessary at all if categories were represented in their own column and data aligned vertically.&lt;BR /&gt;There are times where a wide format is needed, eg when preparing data for regression analysis. But for the processing and storing of data, long formats are always to be preferred.&lt;/P&gt;
&lt;P class="remark-western"&gt;Dynamic variable names force unnecessary dynamic code.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;from &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Maxims-of-Maximally-Efficient-SAS-Programmers/ta-p/352068" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/Maxims-of-Maximally-Efficient-SAS-Programmers/ta-p/352068&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In this case you don't need&amp;nbsp; data step at all:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc transpose data= have out= trance(drop= _name_ rename=(col1 = f));
    by id;
    var f:;
run;

proc freq data= trance noprint;
    table f / out= want;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 06 Sep 2024 06:16:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-macro-variable-from-data-field/m-p/942854#M369663</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2024-09-06T06:16:08Z</dc:date>
    </item>
    <item>
      <title>Re: create macro variable from data field</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-macro-variable-from-data-field/m-p/942855#M369664</link>
      <description>&lt;P&gt;What &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15475"&gt;@andreas_lds&lt;/a&gt;&amp;nbsp;said. Long Beats Wide.&lt;/P&gt;
&lt;P&gt;Bad data structure leads to bad code.&lt;/P&gt;
&lt;P&gt;Also see Maxim 33.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Sep 2024 07:45:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-macro-variable-from-data-field/m-p/942855#M369664</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-09-06T07:45:46Z</dc:date>
    </item>
    <item>
      <title>Re: create macro variable from data field</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-macro-variable-from-data-field/m-p/942880#M369666</link>
      <description>&lt;P&gt;Thanks to both of you for your comments; I agree that long beats wide and that tidy beats messy. And last night as I read my own post, I realized that macros are executed at compile-time execution and not at object-time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I fear that I did not explain my problem very well. I was given a large file: 60-some million person-records, each with their county of residence in each of the 12 months of the year. My task is to count up person-months for each county. So transposing the existing dataset would not be a good thing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The hit-it-with-a-stick approach would be to write out 12 records for each person and then summarize over counties; but I do not relish wrangling 720 million records. Another approach might be to create a monster SELECT(f{i}) "snippet" running from county 01000 to 99999, outputting at EOF and then transposing the results.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was going for some kind of elegant run-time solution that points directly to the county counter that needs to be increased ... maybe a CALL function or something. But I also don't mind hitting something with a stick if it looks to be a one-time thing.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Sep 2024 12:04:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-macro-variable-from-data-field/m-p/942880#M369666</guid>
      <dc:creator>dwaldo</dc:creator>
      <dc:date>2024-09-06T12:04:17Z</dc:date>
    </item>
    <item>
      <title>Re: create macro variable from data field</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-macro-variable-from-data-field/m-p/942881#M369667</link>
      <description>&lt;P&gt;Perfect! Thank you!&lt;/P&gt;</description>
      <pubDate>Fri, 06 Sep 2024 12:15:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-macro-variable-from-data-field/m-p/942881#M369667</guid>
      <dc:creator>dwaldo</dc:creator>
      <dc:date>2024-09-06T12:15:17Z</dc:date>
    </item>
    <item>
      <title>Re: create macro variable from data field</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-macro-variable-from-data-field/m-p/942926#M369674</link>
      <description>&lt;P&gt;So just use the data step view.&lt;/P&gt;
&lt;P&gt;Say you have data structured like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input id year (month1-month12) (&amp;amp; :$40.);
cards;
1 2023 .  .  .  .  NEW YORK  NEW YORK  NEW YORK  NEW YORK  BRONX  BRONX  BRONX  BRONX
1 2024 BRONX  BRONX  BRONX  .  .  .  .  .  .  .  .  .
2 2023 QUEENS  QUEENS  QUEENS  QUEENS  QUEENS  QUEENS  QUEENS  QUEENS  QUEENS  QUEENS  QUEENS  QUEENS
3 2024 RICHMOND  RICHMOND  RICHMOND  RICHMOND    .  .  .  .  .  .  .  .  .
;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then you can convert it into a dataset (or to save disk space a view) that has ID, YEAR, MONTH and COUNTY instead.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data tall / view=tall;
  set have;
  array m month1-month12 ;
  do month=1 to 12;
    COUNTY=m[month];
    if not missing(county) then output;
  end;
  keep id year month county;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now you can summarize by any of your different dimensions.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc summary data=tall missing;
  class year month county;
  output out=want;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 06 Sep 2024 16:40:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-macro-variable-from-data-field/m-p/942926#M369674</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-09-06T16:40:24Z</dc:date>
    </item>
    <item>
      <title>Re: create macro variable from data field</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-macro-variable-from-data-field/m-p/942931#M369677</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/461805"&gt;@dwaldo&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, I fear that I did not explain my problem very well. I was given a large file: 60-some million person-records, each with their county of residence in each of the 12 months of the year. My task is to count up person-months for each county. So transposing the existing dataset would not be a good thing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Why is transposing not a good thing?&lt;/P&gt;
&lt;P&gt;Since transpose won't transpose any missing values you get one person per month with the value. Unless the person id is repeated (have you checked that yet?) then Transpose will have a data set that looks like&lt;/P&gt;
&lt;P&gt;Person _name_of_month_variable&amp;nbsp; col1 (or if you specify a prefix or id value a different name) with Col1 the value of the County.&lt;/P&gt;
&lt;P&gt;Proc freq on the County variable and you have total person months per county.&lt;/P&gt;
&lt;P&gt;Yes the data set is largish. But you are starting with large data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;IF the only thing you want is the count of the number of times a county value appears here is one way:&lt;/P&gt;
&lt;PRE&gt;data have;
   input id f1 $ f2 $ f3 $    ;
datalines;
1 A B C
2 E G A
3 C C C
;

data want;
   set have end=lastone;
   array f(*) f1-f3;
   array t(7) $ 1 _temporary_ ('A','B','C','D','E','F','G');
   array c(*) count1-count7;
   retain count: ;
   do i= 1 to dim(f);
      if not missing(f[i]) then c[ whichc(f[i],of t(*)) ] + 1;
   end;
   if lastone then output;
   drop i f: id;
run;&lt;/PRE&gt;
&lt;P&gt;The _temporary_ array would hold the values of the county name text -&lt;STRONG&gt;as it appears in the data&lt;/STRONG&gt;-.&lt;/P&gt;
&lt;P&gt;The C array would have the same the same number of elements as the number of counties in the temporary array.&lt;/P&gt;
&lt;P&gt;This works by retaining the counter variables and incrementing them each time the value of a county is encountered. WHICHC searches for the first parameter (the monthly county variable value) in the remaining items, in this case an array holding all the names of the counties. The function returns the POSITION number in the searched list (or zero which is why we exclude the missing county if any). That returned value then increments the position counter by 1.&lt;/P&gt;
&lt;P&gt;The data set option END is used so the only output written is when the last record is processed.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Sep 2024 17:20:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-macro-variable-from-data-field/m-p/942931#M369677</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-09-06T17:20:08Z</dc:date>
    </item>
    <item>
      <title>Re: create macro variable from data field</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-macro-variable-from-data-field/m-p/942944#M369685</link>
      <description>&lt;P&gt;Thanks! That seems to be the most elemental solution -- one that first occurred to me and that runs overnight. It has definite curb appeal. I have a wealth of options from which to choose!&lt;/P&gt;</description>
      <pubDate>Fri, 06 Sep 2024 18:26:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-macro-variable-from-data-field/m-p/942944#M369685</guid>
      <dc:creator>dwaldo</dc:creator>
      <dc:date>2024-09-06T18:26:19Z</dc:date>
    </item>
    <item>
      <title>Re: create macro variable from data field</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-macro-variable-from-data-field/m-p/942945#M369686</link>
      <description>&lt;P&gt;Thanks! I like the elegance of this ... but given that county FIPS code sets change from one year to the next, the code line&lt;/P&gt;&lt;PRE&gt;array t(7) $ 1 _temporary_ ('A','B','C','D','E','F','G');&lt;/PRE&gt;&lt;P&gt;could get cumbersome really fast.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'll save this, though, for a time when there are fewer possible field values!&lt;/P&gt;</description>
      <pubDate>Fri, 06 Sep 2024 18:28:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-macro-variable-from-data-field/m-p/942945#M369686</guid>
      <dc:creator>dwaldo</dc:creator>
      <dc:date>2024-09-06T18:28:56Z</dc:date>
    </item>
    <item>
      <title>Re: create macro variable from data field</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-macro-variable-from-data-field/m-p/942950#M369688</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/461805"&gt;@dwaldo&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thanks! I like the elegance of this ... but given that county FIPS code sets change from one year to the next, the code line&lt;/P&gt;
&lt;PRE&gt;array t(7) $ 1 _temporary_ ('A','B','C','D','E','F','G');&lt;/PRE&gt;
&lt;P&gt;could get cumbersome really fast.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'll save this, though, for a time when there are fewer possible field values!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Counties don't change that often generally.My home state, Idaho, hasn't added a county since 1919. The newest county I find in a quick Google search dates from 2001. So changing county FIPS not an annual occurrence.&lt;/P&gt;
&lt;P&gt;If your are using some other FIPS code that might be an issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that you very likely have a SASHELP.ZIPCODE data set. The STATE combined with the COUNTY code value: CountyFips= cats(put(state,z2.), put(county,z3.)); would create the 5-digit FIPS code in a data step or&lt;/P&gt;
&lt;P&gt;cats(put(state,z2.), put(county,z3.)) as CountyFIPS in Proc SQL (likely use as you want distinct State and County values. Note that the county name is there as well though spelling sometimes isn't as locals use.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The SASHELP.ZIPCODE data set is updated by SAS periodically, 3 times in 2024 so far.&lt;/P&gt;
&lt;P&gt;So a list of code should be easy enough to generate from that set.&lt;/P&gt;
&lt;P&gt;If you don't have the data set you can get it with a valid SAS site code and your SAS Community login information. This message has a link you can follow to get it: &lt;A href="https://communities.sas.com/t5/SAS-Hot-Fix-Announcements/Update-available-for-ZIPCODE-data-set-August-2024/ba-p/942377/jump-to/first-unread-message" target="_blank"&gt;https://communities.sas.com/t5/SAS-Hot-Fix-Announcements/Update-available-for-ZIPCODE-data-set-August-2024/ba-p/942377/jump-to/first-unread-message&lt;/A&gt;&amp;nbsp; You can see the updates made available since 2019. They are listed in Year-MON order so the latest is currently 3 from the bottom as AUG comes before FEB and MAY.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In fact if done right you would have a the count to create the limits of the Count variables provided AND code that could assign the FIPS code values as the LABELs for variables such as the proposed Count1- CountXXX using that information.&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>Fri, 06 Sep 2024 19:19:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-macro-variable-from-data-field/m-p/942950#M369688</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-09-06T19:19:00Z</dc:date>
    </item>
    <item>
      <title>Re: create macro variable from data field</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-macro-variable-from-data-field/m-p/942953#M369690</link>
      <description>&lt;P&gt;What is the size of your person key?&lt;/P&gt;
&lt;P&gt;Your observation size would be determined by person key + date + county code, so I assume something like 10 + 4 (SAS dates can be stored in 4 bytes) + 6, giving 20 bytes. So you get 720 * 20 million bytes, or ~ 15 GB, which is really not large for today's computing power.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Sep 2024 19:53:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-macro-variable-from-data-field/m-p/942953#M369690</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-09-06T19:53:11Z</dc:date>
    </item>
    <item>
      <title>Re: create macro variable from data field</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-macro-variable-from-data-field/m-p/942955#M369692</link>
      <description>&lt;P&gt;Agreed that counties don't change very often ... Connecticut was the last big one of which I am aware. Thanks for pointing out that ZIP file -- always good to have something like that on tap.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Sep 2024 20:13:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-macro-variable-from-data-field/m-p/942955#M369692</guid>
      <dc:creator>dwaldo</dc:creator>
      <dc:date>2024-09-06T20:13:57Z</dc:date>
    </item>
    <item>
      <title>Re: create macro variable from data field</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-macro-variable-from-data-field/m-p/942963#M369697</link>
      <description>&lt;P&gt;One thing that is a little weird: somehow this approach loses 1,800 person-months. But that's out of 818,600,000 million person-months, so I think I can live with the results in aggregate &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Sep 2024 21:03:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-macro-variable-from-data-field/m-p/942963#M369697</guid>
      <dc:creator>dwaldo</dc:creator>
      <dc:date>2024-09-06T21:03:27Z</dc:date>
    </item>
    <item>
      <title>Re: create macro variable from data field</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-macro-variable-from-data-field/m-p/942968#M369698</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/461805"&gt;@dwaldo&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;One thing that is a little weird: somehow this approach loses 1,800 person-months. But that's out of 818,600,000 million person-months, so I think I can live with the results in aggregate &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hard to tell which approach you may be discussing as there isn't any quote or reference to which...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Sep 2024 21:34:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-macro-variable-from-data-field/m-p/942968#M369698</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-09-06T21:34:44Z</dc:date>
    </item>
    <item>
      <title>Re: create macro variable from data field</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-macro-variable-from-data-field/m-p/943036#M369714</link>
      <description>&lt;P&gt;In my head I had it right ... I meant&lt;/P&gt;&lt;PRE class=""&gt;&lt;CODE&gt;data _null_;
  set have end=end_of_have;
  length value $10 freq 8;
  if _n_=1 then do;
    declare hash h (ordered:'a');
      h.definekey('value');
      h.definedata('value','freq');
      h.definedone();
  end;
  array month {12} f1-f12;
  do m=1 to 12;
    value=month{m};
    if h.find()^=0 then freq=1;
    else freq=freq+1;
    h.replace();
  end;
  if end_of_have then h.output(dataset:'want');
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 07 Sep 2024 14:36:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-macro-variable-from-data-field/m-p/943036#M369714</guid>
      <dc:creator>dwaldo</dc:creator>
      <dc:date>2024-09-07T14:36:13Z</dc:date>
    </item>
  </channel>
</rss>

