<?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: a simple question in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/a-simple-question/m-p/618431#M181428</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/307641"&gt;@peiy5920&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Sorry, I am new here. I am not sure how to change titiles?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You click on the "gear icon" at the top right of your &lt;FONT color="#FF0000"&gt;&lt;EM&gt;&lt;STRONG&gt;original&lt;/STRONG&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;&lt;EM&gt; message &lt;/EM&gt;&lt;/STRONG&gt;&lt;/FONT&gt;a&lt;FONT color="#000000"&gt;nd then select "Edit Reply". &lt;/FONT&gt;&lt;/P&gt;
&lt;DIV id="tap-translate"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
    <pubDate>Mon, 20 Jan 2020 00:06:39 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2020-01-20T00:06:39Z</dc:date>
    <item>
      <title>a simple question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/a-simple-question/m-p/618414#M181414</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;My sas code like this:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;if EGFR_CKD_EPI&amp;lt;30 then EGFR_CKD_EPI=&amp;lt;30;&lt;BR /&gt;if EGFR_CKD_EPI&amp;gt;=30 and EGFR_CKD_EPI&amp;lt;45 then EGFR_CKD_EPI=30 - 45;&lt;BR /&gt;if EGFR_CKD_EPI&amp;gt;=45 and EGFR_CKD_EPI&amp;lt;60 then EGFR_CKD_EPI=45 - 60;&lt;BR /&gt;if EGFR_CKD_EPI&amp;gt;=60 then EGFR_CKD_EPI=&amp;gt;60;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Are there some problems with the code? Thanks.&lt;/P&gt;</description>
      <pubDate>Sun, 19 Jan 2020 22:59:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/a-simple-question/m-p/618414#M181414</guid>
      <dc:creator>peiy5920</dc:creator>
      <dc:date>2020-01-19T22:59:17Z</dc:date>
    </item>
    <item>
      <title>Re: a simple question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/a-simple-question/m-p/618417#M181417</link>
      <description>&lt;P&gt;What happens when you run it?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please go back and provide a meaningful subject line for your question. "A simple question" as a title means nothing and using meaningful titles help all of us.&lt;/P&gt;
&lt;DIV id="tap-translate"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Sun, 19 Jan 2020 23:06:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/a-simple-question/m-p/618417#M181417</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-01-19T23:06:37Z</dc:date>
    </item>
    <item>
      <title>Re: a simple question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/a-simple-question/m-p/618423#M181421</link>
      <description>Sorry, I am new here. I am not sure how to change titiles?</description>
      <pubDate>Sun, 19 Jan 2020 23:33:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/a-simple-question/m-p/618423#M181421</guid>
      <dc:creator>peiy5920</dc:creator>
      <dc:date>2020-01-19T23:33:42Z</dc:date>
    </item>
    <item>
      <title>Re: a simple question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/a-simple-question/m-p/618427#M181424</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/307641"&gt;@peiy5920&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is that a test question?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1.&amp;nbsp;EGFR_CKD_EPI appears to be numeric so you can't assign a non-numeric value like &amp;lt;30 to it&lt;/P&gt;
&lt;P&gt;2. you would need to pass in a string in quotes like '&amp;lt;30' - but that's not possible here (see 1.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Assuming that's for printing numerical values you normally would define and use a Format for this.&lt;/P&gt;</description>
      <pubDate>Sun, 19 Jan 2020 23:45:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/a-simple-question/m-p/618427#M181424</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2020-01-19T23:45:25Z</dc:date>
    </item>
    <item>
      <title>Re: a simple question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/a-simple-question/m-p/618431#M181428</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/307641"&gt;@peiy5920&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Sorry, I am new here. I am not sure how to change titiles?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You click on the "gear icon" at the top right of your &lt;FONT color="#FF0000"&gt;&lt;EM&gt;&lt;STRONG&gt;original&lt;/STRONG&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;&lt;EM&gt; message &lt;/EM&gt;&lt;/STRONG&gt;&lt;/FONT&gt;a&lt;FONT color="#000000"&gt;nd then select "Edit Reply". &lt;/FONT&gt;&lt;/P&gt;
&lt;DIV id="tap-translate"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Mon, 20 Jan 2020 00:06:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/a-simple-question/m-p/618431#M181428</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-01-20T00:06:39Z</dc:date>
    </item>
    <item>
      <title>Re: a simple question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/a-simple-question/m-p/618446#M181437</link>
      <description>&lt;P&gt;EGFR_CKD_EPI is numeric. It looks like you are trying to create some sort of grouping based on the value of&amp;nbsp;EGFR_CKD_EPI.&lt;/P&gt;
&lt;P&gt;A few options include creating a character variable called group and writing the logic for it in the data step (shown in &lt;STRONG&gt;want_1&amp;nbsp;&lt;/STRONG&gt;step below) or using proc format to pull the logic out of the data step and then create group as shown in&amp;nbsp;&lt;STRONG&gt;want_2&amp;nbsp;&lt;/STRONG&gt;below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
	do EGFR_CKD_EPI=1 to 100;
		output;
	end;
run;

*Format embedded in data step;
data want_1;
	set have;
	format group $8.;

	if EGFR_CKD_EPI&amp;lt;30 then
		group='&amp;lt;30';

	if EGFR_CKD_EPI&amp;gt;=30 and EGFR_CKD_EPI&amp;lt;45 then
		group='30 -&amp;lt; 45';

	if EGFR_CKD_EPI&amp;gt;=45 and EGFR_CKD_EPI&amp;lt;60 then
		group='45 -&amp;lt; 60';

	if EGFR_CKD_EPI&amp;gt;=60 then
		group='&amp;gt;=60';
run;

*Create format using proc format;
proc format;
	value bin low-&amp;lt;30="&amp;lt;30" 30-&amp;lt;45="30 -&amp;lt; 45" 45-&amp;lt;60="45 -&amp;lt; 60" 60-high="&amp;gt;=60";
run;

*Create group based on custom format;
data want_2;
	set have;
	group=put(EGFR_CKD_EPI, bin.);
run;

*Checking frequencies of groups;
proc freq data=want_1 order=data;
tables group/nocol nocum norow nopercent;
run;
proc freq data=want_2 order=data;
tables group/nocol nocum norow nopercent;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 20 Jan 2020 02:37:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/a-simple-question/m-p/618446#M181437</guid>
      <dc:creator>unison</dc:creator>
      <dc:date>2020-01-20T02:37:05Z</dc:date>
    </item>
    <item>
      <title>Re: a simple question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/a-simple-question/m-p/618490#M181460</link>
      <description>&lt;P&gt;I would go with the second solution (the format) suggested by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/270457"&gt;@unison&lt;/a&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In a lot of cases&amp;nbsp;you would not have to create a new variable using the format, just apply it to the variable, e.g. the PROC FREQ example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data=have order=data;
  tables &lt;SPAN&gt;EGFR_CKD_EPI&lt;/SPAN&gt;/nocol nocum norow nopercent;&lt;BR /&gt;  format &lt;SPAN&gt;EGFR_CKD_EPI bin.;&lt;/SPAN&gt;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But if you need to do it in code, use some ELSEs in your code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if EGFR_CKD_EPI&amp;lt;30 then group='&amp;lt;30     ';
else if  EGFR_CKD_EPI&amp;lt;45 then group='30 - 45';
else if EGFR_CKD_EPI&amp;lt;60 then group='45 - 60';
else group='&amp;gt;60';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or use a select statement, that does the same thing:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;select;
  when(EGFR_CKD_EPI&amp;lt;30) group='&amp;lt;30     ';
  when(EGFR_CKD_EPI&amp;lt;45) group='30 - 45';
  when(EGFR_CKD_EPI&amp;lt;60) group='45 - 60';
  otherwise group='&amp;gt;60';
  end;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 20 Jan 2020 10:04:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/a-simple-question/m-p/618490#M181460</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2020-01-20T10:04:54Z</dc:date>
    </item>
  </channel>
</rss>

