<?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: SAS BASE in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-BASE/m-p/747322#M234538</link>
    <description>&lt;P&gt;Well, I put it there to only include non-missing age values.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 11 Jun 2021 12:41:43 GMT</pubDate>
    <dc:creator>tarheel13</dc:creator>
    <dc:date>2021-06-11T12:41:43Z</dc:date>
    <item>
      <title>SAS BASE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-BASE/m-p/747300#M234525</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Read sample input of 5 rows &amp;amp; 3 columns &amp;nbsp;(name , Gender, Age) using data lines into a &amp;nbsp;temporary SAS dataset, &amp;nbsp;and create new column Age-group with values ( &amp;gt;45, 18-44, 0-5,5-11,11-18 ) while reading the datalines into SAS datasets.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Based on age column,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Create a new column Age group&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Based a=on age value derive age group below is example for Age value and corresponding age group value.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Age Agegroup&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0-5&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;65&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt;45&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;90&amp;nbsp;&amp;nbsp; &amp;gt;45&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;30&amp;nbsp;&amp;nbsp; 18-44&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;SOLUTION:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;data task;&lt;BR /&gt;input name $ gender $ age;&lt;BR /&gt;datalines;&lt;BR /&gt;Reena F 25&lt;BR /&gt;Shyam M 40&lt;BR /&gt;Deva M 53&lt;BR /&gt;John M 63&lt;BR /&gt;Mery F 9&lt;BR /&gt;;&lt;BR /&gt;a=age;&lt;BR /&gt;if 0&amp;lt;a&amp;lt;=5 then agegroup=0-5;&lt;BR /&gt;if 5&amp;lt;a&amp;lt;=11 then agegroup=5-11;&lt;BR /&gt;if 11&amp;lt;a&amp;lt;=18 then agegroup =11-18;&lt;BR /&gt;if 18&amp;lt;a&amp;lt;=44 then agegroup=18-44;&lt;BR /&gt;if a&amp;gt;45 then agegroup=&amp;gt;45;&lt;BR /&gt;run;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I have tried in this way but its not coming.&amp;nbsp; please help me out......&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Fri, 11 Jun 2021 10:48:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-BASE/m-p/747300#M234525</guid>
      <dc:creator>u58780790</dc:creator>
      <dc:date>2021-06-11T10:48:13Z</dc:date>
    </item>
    <item>
      <title>Re: SAS BASE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-BASE/m-p/747304#M234527</link>
      <description>&lt;P&gt;Surely your teacher and course material showed you how to do this.&lt;/P&gt;
&lt;P&gt;What have you tried?&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jun 2021 10:48:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-BASE/m-p/747304#M234527</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-06-11T10:48:46Z</dc:date>
    </item>
    <item>
      <title>Re: SAS BASE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-BASE/m-p/747305#M234528</link>
      <description>Hii&lt;BR /&gt;&lt;BR /&gt;No I tried!... One line logic is not getting! Help me out&lt;BR /&gt;</description>
      <pubDate>Fri, 11 Jun 2021 10:56:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-BASE/m-p/747305#M234528</guid>
      <dc:creator>u58780790</dc:creator>
      <dc:date>2021-06-11T10:56:24Z</dc:date>
    </item>
    <item>
      <title>Re: SAS BASE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-BASE/m-p/747307#M234529</link>
      <description>&lt;P&gt;Please&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;change the title so that it is in closer connection to the problem you have,&lt;/LI&gt;
&lt;LI&gt;use the "insert sas code" button to insert properly formatted code,&lt;/LI&gt;
&lt;LI&gt;show what you have tried so far.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;I would use proc format to define a format, to avoid if-then-else, and then, after the input-statement, the input-function:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;agegroup = input(Age, AgeGroupFmt.);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 11 Jun 2021 11:04:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-BASE/m-p/747307#M234529</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2021-06-11T11:04:19Z</dc:date>
    </item>
    <item>
      <title>Re: SAS BASE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-BASE/m-p/747309#M234531</link>
      <description>data sample;&lt;BR /&gt;input name $ gender $ age;&lt;BR /&gt;datalines;&lt;BR /&gt;Vinod M 10&lt;BR /&gt;Shalini F 18&lt;BR /&gt;Reena F 25&lt;BR /&gt;Rishi M 40&lt;BR /&gt;Sampath M 55&lt;BR /&gt;;&lt;BR /&gt;a=age&lt;BR /&gt;aggrp=put(a,agegroup.);&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;proc format;&lt;BR /&gt;value agegroup&lt;BR /&gt;0-5='0-5'&lt;BR /&gt;5-11='5-11'&lt;BR /&gt;11-18='11-18'&lt;BR /&gt;18-44='18-44'&lt;BR /&gt;&amp;gt;45='&amp;gt;45';&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 11 Jun 2021 11:08:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-BASE/m-p/747309#M234531</guid>
      <dc:creator>u58780790</dc:creator>
      <dc:date>2021-06-11T11:08:03Z</dc:date>
    </item>
    <item>
      <title>Re: SAS BASE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-BASE/m-p/747313#M234533</link>
      <description>&lt;P&gt;You have some nearly working pieces.&amp;nbsp; Let's change a few things.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First, to use a format you have to first create it.&amp;nbsp; So PROC FORMAT must be moved to before the DATA step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Second, there is a syntax error in the PROC FORMAT.&amp;nbsp; The way to get 45 and higher in the same group is to specify:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;45 - high = '&amp;gt;45';&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Third, expect that the first mention of a number determines which group it belongs to.&amp;nbsp; So 5 will go into the "0-5" category, not into the "5-11" category.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Fourth, there is no need to create the variable A.&amp;nbsp; You have AGE, and can use it:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;aggrp=put(age, agegroup.);&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jun 2021 12:11:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-BASE/m-p/747313#M234533</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2021-06-11T12:11:14Z</dc:date>
    </item>
    <item>
      <title>Re: SAS BASE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-BASE/m-p/747315#M234534</link>
      <description>proc format;&lt;BR /&gt;value agegroup&lt;BR /&gt;0-5='0-5'&lt;BR /&gt;6-11='5-11'&lt;BR /&gt;12-18='11-18'&lt;BR /&gt;19-44='18-44'&lt;BR /&gt;45-high='&amp;gt;45';&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;data sample;&lt;BR /&gt;input name $ gender $ age;&lt;BR /&gt;datalines;&lt;BR /&gt;Vinod M 10&lt;BR /&gt;Shalini F 18&lt;BR /&gt;Reena F 25&lt;BR /&gt;Rishi M 40&lt;BR /&gt;Sam M 55&lt;BR /&gt;;&lt;BR /&gt;aggrp=input(age,agegroup.);&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Is this right ?&lt;BR /&gt;But it doesn't give the output... shows error at aggrp line....&lt;BR /&gt;</description>
      <pubDate>Fri, 11 Jun 2021 12:27:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-BASE/m-p/747315#M234534</guid>
      <dc:creator>u58780790</dc:creator>
      <dc:date>2021-06-11T12:27:17Z</dc:date>
    </item>
    <item>
      <title>Re: SAS BASE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-BASE/m-p/747317#M234535</link>
      <description>&lt;P&gt;Those formats are not going to work the way you've written them. Please try my code.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
proc format;
	value agegroupf
	1='0-5'
	2='5-11'
	3='11-18'
	4='18-44'
	5='&amp;gt;45';
run;

 data task2;
 	set task;
	format agegroup agegroupf.;
	if age &amp;gt; .z then do;
	if age lt 5 then agegroup=1;
	else if 5 le age lt 11 then agegroup=2;
	else if 11 le age lt 18 then agegroup=3;
	else if 18 le age lt 45 then agegroup=4;
	else if age ge 45 then agegroup=5;
		end;
run;

title "Check agegroup derivation";
proc means data=task2 n nmiss min max;
	var age;
	class agegroup / missing;
run;
title;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 11 Jun 2021 12:28:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-BASE/m-p/747317#M234535</guid>
      <dc:creator>tarheel13</dc:creator>
      <dc:date>2021-06-11T12:28:12Z</dc:date>
    </item>
    <item>
      <title>Re: SAS BASE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-BASE/m-p/747319#M234536</link>
      <description>&lt;P&gt;You switched the PUT function to the INPUT function.&amp;nbsp; Restore the PUT function.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jun 2021 12:30:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-BASE/m-p/747319#M234536</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2021-06-11T12:30:25Z</dc:date>
    </item>
    <item>
      <title>Re: SAS BASE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-BASE/m-p/747320#M234537</link>
      <description>if age &amp;gt; .z then do;&lt;BR /&gt;&lt;BR /&gt;can u explain y this comes?&lt;BR /&gt;</description>
      <pubDate>Fri, 11 Jun 2021 12:36:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-BASE/m-p/747320#M234537</guid>
      <dc:creator>u58780790</dc:creator>
      <dc:date>2021-06-11T12:36:05Z</dc:date>
    </item>
    <item>
      <title>Re: SAS BASE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-BASE/m-p/747322#M234538</link>
      <description>&lt;P&gt;Well, I put it there to only include non-missing age values.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jun 2021 12:41:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-BASE/m-p/747322#M234538</guid>
      <dc:creator>tarheel13</dc:creator>
      <dc:date>2021-06-11T12:41:43Z</dc:date>
    </item>
    <item>
      <title>Re: SAS BASE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-BASE/m-p/747324#M234539</link>
      <description>&lt;P&gt;You're still going to get errors with the code like that. You need to move aggrp before datalines statement but I also think your ranges in proc format are not good. What if someone has an age between 5 and 6 or between 11 and 12? All of those people are going to get left out with the way you've assigned the ranges. Please read the documentation.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/vdmmlcdc/8.1/proc/n03qskwoints2an1ispy57plwrn9.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/vdmmlcdc/8.1/proc/n03qskwoints2an1ispy57plwrn9.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Also, it is ALWAYS a good idea to check your work. Please run the proc means that I use to check the derivation of aggrp.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
value agegroup
0-5='0-5'
6-11='5-11'
12-18='11-18'
19-44='18-44'
45-high='&amp;gt;45';
run;


data sample;
	infile datalines;
	input name $ gender $ age;
	aggrp=put(age,agegroup.);
	datalines;
Vinod M 10
Shalini F 18
Reena F 25
Rishi M 40
Sam M 55
;
proc print data=sample;
run;

proc means data=sample n nmiss min max;	
	var age;
	class agegroup / missing;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jun 2021 12:52:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-BASE/m-p/747324#M234539</guid>
      <dc:creator>tarheel13</dc:creator>
      <dc:date>2021-06-11T12:52:32Z</dc:date>
    </item>
    <item>
      <title>Re: SAS BASE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-BASE/m-p/747330#M234540</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/385497"&gt;@u58780790&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;proc format;&lt;BR /&gt;value agegroup&lt;BR /&gt;0-5='0-5'&lt;BR /&gt;6-11='5-11'&lt;BR /&gt;12-18='11-18'&lt;BR /&gt;19-44='18-44'&lt;BR /&gt;45-high='&amp;gt;45';&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;data sample;&lt;BR /&gt;input name $ gender $ age;&lt;BR /&gt;datalines;&lt;BR /&gt;Vinod M 10&lt;BR /&gt;Shalini F 18&lt;BR /&gt;Reena F 25&lt;BR /&gt;Rishi M 40&lt;BR /&gt;Sam M 55&lt;BR /&gt;;&lt;BR /&gt;aggrp=input(age,agegroup.);&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Is this right ?&lt;BR /&gt;But it doesn't give the output... shows error at aggrp line....&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The crucial point is the DATALINES statement, which is documented&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/lestmtsref/p0114gachtut3nn1and4ap8ke9nf.htm" target="_blank" rel="noopener"&gt;here&lt;/A&gt;; you will find the clue in there.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jun 2021 13:34:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-BASE/m-p/747330#M234540</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-06-11T13:34:16Z</dc:date>
    </item>
    <item>
      <title>Re: SAS BASE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-BASE/m-p/747333#M234541</link>
      <description>can it be done in datastep without proc format?&lt;BR /&gt;</description>
      <pubDate>Fri, 11 Jun 2021 13:45:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-BASE/m-p/747333#M234541</guid>
      <dc:creator>u58780790</dc:creator>
      <dc:date>2021-06-11T13:45:33Z</dc:date>
    </item>
    <item>
      <title>Re: SAS BASE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-BASE/m-p/747337#M234543</link>
      <description>&lt;P&gt;I have shown a data step solution. If you don't want to do agegroup=1,2,3,4,5 and apply a format then just set agegroup = '0-5', '5-11' and so on and so forth.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jun 2021 13:51:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-BASE/m-p/747337#M234543</guid>
      <dc:creator>tarheel13</dc:creator>
      <dc:date>2021-06-11T13:51:29Z</dc:date>
    </item>
    <item>
      <title>Re: SAS BASE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-BASE/m-p/747348#M234548</link>
      <description>&lt;P&gt;One last response, modifying your latest program slightly:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
value agegroup
0-5='0-5'
6-11='5-11'
12-18='11-18'
19-44='18-44'
45-high='&amp;gt;45';
run;

data sample;
input name $ gender $ age;
aggrp = put(age, agegroup.);
datalines;
Vinod M 10
Shalini F 18
Reena F 25
Rishi M 40
Sam M 55
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Once a semicolon marks the end of the datalines, you no longer need a run statement.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jun 2021 14:17:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-BASE/m-p/747348#M234548</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2021-06-11T14:17:33Z</dc:date>
    </item>
    <item>
      <title>Re: SAS BASE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-BASE/m-p/747370#M234558</link>
      <description>&lt;P&gt;You missed a few concepts with your initial code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;No code after datalines is executed. You needed to move your IF statements BEFORE your datalines/cards statements.&lt;/LI&gt;
&lt;LI&gt;Use IF/ELSE IF, not multiple IF statements&lt;/LI&gt;
&lt;LI&gt;AgeGroup values need to be in quotation marks as it's a character variable.&lt;/LI&gt;
&lt;LI&gt;Set a length for AgeGroup ahead of time so that the value isn't truncated.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example is &lt;A href="https://gist.github.com/statgeek/227565537f3dffcd8627f1fe2eff844f" target="_self"&gt;here&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data task;
input name $ gender $ age;
a=age;

length agegroup $10.;

if 0&amp;lt;a&amp;lt;=5 then agegroup="0-5";
else if 5&amp;lt;a&amp;lt;=11 then agegroup="5-11";
else if 11&amp;lt;a&amp;lt;=18 then agegroup ="11-18";
else if 18&amp;lt;a&amp;lt;=44 then agegroup="18-44";
else if a&amp;gt;45 then agegroup= "&amp;gt;45";

datalines;
Reena F 25
Shyam M 40
Deva M 53
John M 63
Mery F 9
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/385497"&gt;@u58780790&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;SPAN&gt;Read sample input of 5 rows &amp;amp; 3 columns &amp;nbsp;(name , Gender, Age) using data lines into a &amp;nbsp;temporary SAS dataset, &amp;nbsp;and create new column Age-group with values ( &amp;gt;45, 18-44, 0-5,5-11,11-18 ) while reading the datalines into SAS datasets.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Based on age column,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Create a new column Age group&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Based a=on age value derive age group below is example for Age value and corresponding age group value.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Age Agegroup&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0-5&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;65&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt;45&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;90&amp;nbsp;&amp;nbsp; &amp;gt;45&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;30&amp;nbsp;&amp;nbsp; 18-44&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;SOLUTION:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV&gt;data task;&lt;BR /&gt;input name $ gender $ age;&lt;BR /&gt;datalines;&lt;BR /&gt;Reena F 25&lt;BR /&gt;Shyam M 40&lt;BR /&gt;Deva M 53&lt;BR /&gt;John M 63&lt;BR /&gt;Mery F 9&lt;BR /&gt;;&lt;BR /&gt;a=age;&lt;BR /&gt;if 0&amp;lt;a&amp;lt;=5 then agegroup=0-5;&lt;BR /&gt;if 5&amp;lt;a&amp;lt;=11 then agegroup=5-11;&lt;BR /&gt;if 11&amp;lt;a&amp;lt;=18 then agegroup =11-18;&lt;BR /&gt;if 18&amp;lt;a&amp;lt;=44 then agegroup=18-44;&lt;BR /&gt;if a&amp;gt;45 then agegroup=&amp;gt;45;&lt;BR /&gt;run;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;I have tried in this way but its not coming.&amp;nbsp; please help me out......&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jun 2021 15:17:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-BASE/m-p/747370#M234558</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-06-11T15:17:36Z</dc:date>
    </item>
    <item>
      <title>Re: SAS BASE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-BASE/m-p/747373#M234559</link>
      <description>where the datastep solution has? can u show me?</description>
      <pubDate>Fri, 11 Jun 2021 15:22:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-BASE/m-p/747373#M234559</guid>
      <dc:creator>u58780790</dc:creator>
      <dc:date>2021-06-11T15:22:10Z</dc:date>
    </item>
    <item>
      <title>Re: SAS BASE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-BASE/m-p/747376#M234561</link>
      <description>&lt;P&gt;Would you please look at what&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;just posted? A lot of people have given you solutions now.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jun 2021 15:33:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-BASE/m-p/747376#M234561</guid>
      <dc:creator>tarheel13</dc:creator>
      <dc:date>2021-06-11T15:33:48Z</dc:date>
    </item>
    <item>
      <title>Re: SAS BASE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-BASE/m-p/747378#M234563</link>
      <description>yup i am seeing that&lt;BR /&gt;thank u !</description>
      <pubDate>Fri, 11 Jun 2021 15:35:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-BASE/m-p/747378#M234563</guid>
      <dc:creator>u58780790</dc:creator>
      <dc:date>2021-06-11T15:35:57Z</dc:date>
    </item>
  </channel>
</rss>

