<?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: how to create a variable and assign a value in sas data step hash object in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-create-a-variable-and-assign-a-value-in-sas-data-step/m-p/410134#M100239</link>
    <description>&lt;P&gt;Whilst its great to use new technology, would it not be simpler, and far easier to read to just do two steps here:&lt;/P&gt;
&lt;PRE&gt;proc sort data=enddates nodupkey;
  by usubjid descending dsendtc;
run;

data se;
  merge raw.ta enddates;
  by usubjid;
  ... /* Do you other processing here */
run;&lt;/PRE&gt;
&lt;P&gt;Its only worth using some technology if there is a benefit to the code for using that technology, and in this case the task can be taken care of with simpler, shorter code (and most likely with less memory overhead).&amp;nbsp; Avoid using something just for the purpose of using it.&lt;/P&gt;</description>
    <pubDate>Fri, 03 Nov 2017 09:37:16 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2017-11-03T09:37:16Z</dc:date>
    <item>
      <title>how to create a variable and assign a value in sas data step hash object</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-create-a-variable-and-assign-a-value-in-sas-data-step/m-p/410111#M100230</link>
      <description>&lt;P&gt;&amp;nbsp;I have hash object datastep and in that need to create a variable like domain="SE" but it is not happening. any reason where i did something wrong. any guidance?&lt;/P&gt;&lt;PRE&gt;	data se;
		set startdates;		
		by usubjid
			descending startdate
			descending taetord
			element;
		if _n_=0 then set enddates raw.ta;
		if _N_ = 1 then do;
			declare hash lastdate(dataset:"enddates");
			lastdate.definekey("usubjid");
			lastdate.definedata("dsendtc");
			lastdate.definedone();

			declare hash Tarm(dataset:"raw.TA");
			Tarm.definekey("ETCD");
			Tarm.definedata("EPOCH");
			Tarm.definedone();
		end;
		length oldstart $20;
		retain oldstart;
		SESTDTC=scan(DSSTDTC,1,'T');
		rc1=Tarm.find();
		if not first.usubjid then do;
			SEENDTC=scan(oldstart,1,'T');
		end;
		else do;
			rc=lastdate.find();
			if rc=0 then SEENDTC=scan(DSENDTC,1,'T');
		end;
		if missing(sestdtc) and not missing(seendtc) then delete;
		if SEENDTC&amp;gt;SESTDTC or first.usubjid then output;
		oldstart=DSSTDTC;
        rename TAETORD=SESEQ;
		domain='SE';
		drop rc rc1 dsstdtc startdate enddate domain tatrans tabranch oldstart dsendtc arm armcd TESTRL;
	run;&lt;/PRE&gt;</description>
      <pubDate>Fri, 03 Nov 2017 08:16:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-create-a-variable-and-assign-a-value-in-sas-data-step/m-p/410111#M100230</guid>
      <dc:creator>mj5</dc:creator>
      <dc:date>2017-11-03T08:16:46Z</dc:date>
    </item>
    <item>
      <title>Re: how to create a variable and assign a value in sas data step hash object</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-create-a-variable-and-assign-a-value-in-sas-data-step/m-p/410113#M100232</link>
      <description>&lt;P&gt;When you have a problem:&lt;/P&gt;
&lt;P&gt;- post the complete log of the step (or excerpts if same messages are repeated)&lt;/P&gt;
&lt;P&gt;- example data to run the code against. Use a data step with datalines.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Nov 2017 08:25:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-create-a-variable-and-assign-a-value-in-sas-data-step/m-p/410113#M100232</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-11-03T08:25:53Z</dc:date>
    </item>
    <item>
      <title>Re: how to create a variable and assign a value in sas data step hash object</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-create-a-variable-and-assign-a-value-in-sas-data-step/m-p/410134#M100239</link>
      <description>&lt;P&gt;Whilst its great to use new technology, would it not be simpler, and far easier to read to just do two steps here:&lt;/P&gt;
&lt;PRE&gt;proc sort data=enddates nodupkey;
  by usubjid descending dsendtc;
run;

data se;
  merge raw.ta enddates;
  by usubjid;
  ... /* Do you other processing here */
run;&lt;/PRE&gt;
&lt;P&gt;Its only worth using some technology if there is a benefit to the code for using that technology, and in this case the task can be taken care of with simpler, shorter code (and most likely with less memory overhead).&amp;nbsp; Avoid using something just for the purpose of using it.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Nov 2017 09:37:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-create-a-variable-and-assign-a-value-in-sas-data-step/m-p/410134#M100239</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-11-03T09:37:16Z</dc:date>
    </item>
    <item>
      <title>Re: how to create a variable and assign a value in sas data step hash object</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-create-a-variable-and-assign-a-value-in-sas-data-step/m-p/410141#M100241</link>
      <description>&lt;P&gt;And if you're just after a quick method to do a lookup without sorting, consider using formats created from raw.ta and enddates.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Nov 2017 09:50:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-create-a-variable-and-assign-a-value-in-sas-data-step/m-p/410141#M100241</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-11-03T09:50:26Z</dc:date>
    </item>
  </channel>
</rss>

