tag:blogger.com,1999:blog-7958828565254404797.post4640041282634841542..comments2024-03-29T00:02:14.892-07:00Comments on ListenData: SAS : IF-Then-Else StatementsDeepanshu Bhallahttp://www.blogger.com/profile/09802839558125192674noreply@blogger.comBlogger12125tag:blogger.com,1999:blog-7958828565254404797.post-89613267811040134962022-07-31T01:07:59.374-07:002022-07-31T01:07:59.374-07:00DATA SHOERANGE;
LENGTH SHOERANGE$10.;
SET SASHELP....<br />DATA SHOERANGE;<br />LENGTH SHOERANGE$10.;<br />SET SASHELP.SHOES;<br />IF SALES < 100000 THEN SHOERANGE ="LOWER";<br />ELSE IF (SALES GT 10000) OR (SALES LT 20000) THEN SHOERANGE ="MIDDLE";<br />ELSE IF SALES > 200000 THEN SHOERANGE="UPPER";<br />RUN;<br />Pavankalyangoudhttps://www.blogger.com/profile/17273243959040160359noreply@blogger.comtag:blogger.com,1999:blog-7958828565254404797.post-73488508047426470292022-05-27T11:31:37.345-07:002022-05-27T11:31:37.345-07:00Hii Sir,
Read sashelp.shoes as input.
• Create a n...Hii Sir,<br />Read sashelp.shoes as input.<br />• Create a new SAS data set, work.shoerange.<br />• Create a new character variable SalesRange that will be used to categorize the observations into<br />three groups.<br />• Set the value of SalesRange to the following:<br />o Lower when Sales are less than $100,000.<br />o Middle when Sales are between $100,000 and $200,000, inclusively.<br />o Upper when Sales are above $200,000.<br /><br /> RUN thismanojhttps://www.blogger.com/profile/15527237771143998096noreply@blogger.comtag:blogger.com,1999:blog-7958828565254404797.post-66005980304280228332022-01-20T23:01:24.995-08:002022-01-20T23:01:24.995-08:00DAta readin1;
set readin;
length Tag $30;
If ID in...DAta readin1;<br />set readin;<br />length Tag $30;<br />If ID in (1,5,45,76) then tag ='Incorrect';<br />run;<br />proc print;run;<br /><br />What's wrong in my code?<br />unable to show as incorrect in the output<br /><br />Ans: it will not show incorrect in output because the id's which you mentioned in in (1,5,45,76)statement are not present in sas dataset. so change the values as we have in readin dataset and try it will work. ravihttps://www.blogger.com/profile/12051180291065695712noreply@blogger.comtag:blogger.com,1999:blog-7958828565254404797.post-39059128517892203942021-01-19T12:05:25.703-08:002021-01-19T12:05:25.703-08:00ID does not contain values (1,5,45,76).ID does not contain values (1,5,45,76).Anonymoushttps://www.blogger.com/profile/03387847735143906782noreply@blogger.comtag:blogger.com,1999:blog-7958828565254404797.post-62251569687768870162020-05-06T01:36:22.776-07:002020-05-06T01:36:22.776-07:00You didn't specify what data to print.
The la...You didn't specify what data to print.<br /><br />The last line should read;<br /><br />proc print data=reading1;<br />run;Kaybesthttps://www.blogger.com/profile/11103046457123891488noreply@blogger.comtag:blogger.com,1999:blog-7958828565254404797.post-16043522701470998842020-05-01T07:50:30.112-07:002020-05-01T07:50:30.112-07:00DAta readin1;
set readin;
length Tag $30;
If ID in...DAta readin1;<br />set readin;<br />length Tag $30;<br />If ID in (1,5,45,76) then tag ='Incorrect';<br />run;<br />proc print;run;<br /><br />What's wrong in my code? <br />unable to show as incorrect in the outputunknownnoreply@blogger.comtag:blogger.com,1999:blog-7958828565254404797.post-66351415642796968052019-06-15T11:33:50.290-07:002019-06-15T11:33:50.290-07:00It says if ID is less than or equals to 75 or less...It says if ID is less than or equals to 75 or less than 75.<br />It means if ID is between 75 and 100 then tag as New.Chithari Ravihttps://www.blogger.com/profile/14936309635501710509noreply@blogger.comtag:blogger.com,1999:blog-7958828565254404797.post-81075754630366224612019-05-14T00:51:20.515-07:002019-05-14T00:51:20.515-07:00Hi. It shows me LE instead GE in below code
Data ...Hi. It shows me LE instead GE in below code<br /><br />Data readin1;<br />Set readin;<br />length TAG $20;<br />IF ID < 75 THEN TAG ="Old";<br />ELSE IF 75 <= ID < 100 THEN TAG = "New"; <br />ELSE IF ID >= 100 THEN TAG ="Unchecked";<br />run; <br /><br />Can you please help me explaning 2nd statement<br /><br />ELSE IF 75 <= ID < 100 THEN TAG = "New"; Kunalhttps://www.blogger.com/profile/04788709958629000658noreply@blogger.comtag:blogger.com,1999:blog-7958828565254404797.post-91472414848706670482018-06-06T22:09:26.610-07:002018-06-06T22:09:26.610-07:00This comment has been removed by the author.manishhttps://www.blogger.com/profile/02458283117087777210noreply@blogger.comtag:blogger.com,1999:blog-7958828565254404797.post-53535023567532348422018-04-25T15:42:46.641-07:002018-04-25T15:42:46.641-07:00Are you from a non-technical background?Are you from a non-technical background?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7958828565254404797.post-6185473807816530092016-05-24T15:09:45.768-07:002016-05-24T15:09:45.768-07:00Please can you explain us details about if/then/el...Please can you explain us details about if/then/else.How behind the scene it works. I try to get the clue but still I am not clear.For example putting if only without else how it works ? putting else if how it works ? At end only else how it works ? Putting only if without then how it works? How it works with do loop and array ? Basically while I am trying to understand Sas certified question (Mostly program with if/then/else/do statement and question is how many observations)it making me a lot confuse.Sumanhttps://www.blogger.com/profile/09451214907584466972noreply@blogger.comtag:blogger.com,1999:blog-7958828565254404797.post-56339728228785550682016-01-15T00:44:02.418-08:002016-01-15T00:44:02.418-08:00This comment has been removed by the author.Anonymoushttps://www.blogger.com/profile/04403619180168703653noreply@blogger.com