Actuarial Outpost Simple SAS Questions
 User Name Remember Me? Password
 Register Blogs Wiki FAQ Calendar Search Today's Posts Mark Forums Read
 FlashChat Actuarial Discussion Preliminary Exams CAS/SOA Exams Cyberchat Around the World Suggestions

 Upload your resume securely at https://www.dwsimpson.com to be contacted when new jobs meet your skills and objectives.

 Thread Tools Search this Thread Display Modes
#231
11-10-2017, 08:21 PM
 BassFreq Member CAS Join Date: Jun 2003 Location: Chicago Studying for all eternity Favorite beer: Duff Posts: 1,708 Blog Entries: 2

Quote:
 Originally Posted by LICENSED TO ILL I am updating code in another's program and have tried a few times to get a loop+macro to work for this in a data step: if X = 1 then BASE_CC = ORIG_CC1; if X = 2 then BASE_CC = ORIG_CC2; if X = 3 then BASE_CC = ORIG_CC3; if X = 4 then BASE_CC = ORIG_CC4; if X = 5 then BASE_CC = ORIG_CC5; etc... Can anyone help me look like a SASballer plz?
Assuming all of the ORIG_CC: are next to each other and ordered...

Code:
```/* like a SASballer I */
array OG{5} ORIG_CC1-ORIG_CC5;
BASE_CC = OG(X);
/* props to BassFreq*/
/* mic drop */```
You can use that, but only if you keep my comments with it.
__________________
If at first you don't succeed, you have one data point.
Res ipsa loquitur, sed quid in infernos dicet?
#232
11-10-2017, 08:21 PM
 NormalDan Member CAS Join Date: Dec 2016 Location: NJ Posts: 6,758

Quote:
 Originally Posted by BassFreq Assuming all of the ORIG_CC: are next to each other and ordered... Code: ```/* like a SASballer I */ array OG{5} ORIG_CC1-ORIG_CC5; BASE_CC = OG(X); /* props to BassFreq*/ /* mic drop */``` You can use that, but only if you keep my comments with it.
#233
11-10-2017, 08:32 PM
 Whiskey Member CAS Join Date: Jul 2008 Studying for nothing at all Posts: 37,865

Quote:
 Originally Posted by BassFreq Assuming all of the ORIG_CC: are next to each other and ordered... Code: ```/* like a SASballer I */ array OG{5} ORIG_CC1-ORIG_CC5; BASE_CC = OG(X); /* props to BassFreq*/ /* mic drop */``` You can use that, but only if you keep my comments with it.
Good answer.

Should have read the question better the first time.
__________________
Whiskey "on tap" - 12/31/15
Spoiler:

Bourbon(16)
Pappy Van Winkle-Family Reserve 15yr & lot "B" 12yr
Baker's 7yr
Blanton's
Knob Creek - 9yr
Basil Hayden
Maker's Mark - 46 & Cask Strength
Woodford Reserve
Jack Daniel's-Gentleman Jack, Single Barrel & Old #7
Four Roses Small Batch
Noah's Mill
Kirkland Bourbon - 7yr

Rye(6)
Angle Envy's - Finished Rye
Ravenswood Rye
Bulleit
High West - Double Rye
Whistle Pig - 10 yr
Old Overholt

Scotch(4)
Glenfiddich - The Distiller's Edition
Tomatin 12yr
The Dimple Pinch - 15 yr
Dewar's White Label

Irish(6)

Middleton Very Rare
Redbreast 12yr
Bushmill - Single Malt 16 yr
Connemarai
Jameson - Caskmates Stout and Regular
#234
11-13-2017, 10:32 AM
 ALivelySedative Member CAS Join Date: Dec 2013 Location: Land of the Pine College: UNC-Chapel Hill Alum Favorite beer: Red Oak Posts: 2,556

Quote:
 Originally Posted by Childish Gambino This will assign the string 'orig_cc#'. He wants a variable called orig_cc#
Oh duh.

Quote:
 Originally Posted by Childish Gambino %let origCat = X; base_cc = orig_cc&origCat;
Doesn't the reference have to end with a '.' ?
ie orig_cc&origCat.;
Haven't written a macro in awhile myself so I can't remember.
#235
11-13-2017, 01:36 PM
 Childish Gambino Member SOA Join Date: Jul 2014 Posts: 25,153

Quote:
 Originally Posted by ALivelySedative Oh duh. Doesn't the reference have to end with a '.' ? ie orig_cc&origCat.; Haven't written a macro in awhile myself so I can't remember.
Not really. You only need the dot if you plan to continue the text. A way of telling SAS where the macro variable ends.

orig_cc&origCat.stuff;

Some people say it's good practice to put it on all the macros. But that seems like preference.
__________________
When fascism comes to America, it will be wrapped in the US Flag and carrying a Cross.
#236
11-14-2017, 09:41 AM
 LICENSED TO ILL Member Join Date: Oct 2005 Posts: 742

The Array worked perfect! Thanks! everyone.
__________________
Spoiler:
Quote:
 Originally Posted by Abelian Grape Nothing gay about mirin' another bro's gains.
Quote:
 Originally Posted by campbell Want to become aware of my fist?
Quote:
 Originally Posted by OddSox this might be my favorite thread on the AO
#237
11-14-2017, 09:59 AM
 ALivelySedative Member CAS Join Date: Dec 2013 Location: Land of the Pine College: UNC-Chapel Hill Alum Favorite beer: Red Oak Posts: 2,556

Anyone have any experience using sas/connect so as to code on PC but have it run on a company mainframe? I continue to dislike z/OS.

I'm assuming i'd need an additional base sas license for the PC version and add on sas/connect as well. I doubt i can convince anyone that the expense is worth it, but just curious if it's been done elsewhere.
#238
11-20-2017, 10:19 AM
 LICENSED TO ILL Member Join Date: Oct 2005 Posts: 742

OK, logic works in my head for this nested if-then-else statement. Nothing seems to get rid of the error.

IF Group = 'FirstChoice' then do;

IF years <= 2 then; Benefit_per = 2;
ELSE IF years > 10 then; Benefit_per = 99;
ELSE Benefit_per = years;

END;

ERROR 160-185: No matching IF-THEN clause.
__________________
Spoiler:
Quote:
 Originally Posted by Abelian Grape Nothing gay about mirin' another bro's gains.
Quote:
 Originally Posted by campbell Want to become aware of my fist?
Quote:
 Originally Posted by OddSox this might be my favorite thread on the AO
#239
11-20-2017, 10:24 AM
 ALivelySedative Member CAS Join Date: Dec 2013 Location: Land of the Pine College: UNC-Chapel Hill Alum Favorite beer: Red Oak Posts: 2,556

don't need the semicolon after 'then'

Code:
```if group = 'FirstChoice' then
do;
if years <= 2 then Benefit_per = 2;
else if years > 10 then Benefit_per = 99;
else Benefit_per = years;
end;```
#240
11-20-2017, 10:34 AM
 LICENSED TO ILL Member Join Date: Oct 2005 Posts: 742

oh my

[Aladin] Well I feel sheepish[/Aladin]
__________________
Spoiler:
Quote:
 Originally Posted by Abelian Grape Nothing gay about mirin' another bro's gains.
Quote:
 Originally Posted by campbell Want to become aware of my fist?
Quote:
 Originally Posted by OddSox this might be my favorite thread on the AO

 Thread Tools Search this Thread Search this Thread: Advanced Search Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off

All times are GMT -4. The time now is 08:22 AM.

 -- Default Style - Fluid Width ---- Default Style - Fixed Width ---- Old Default Style ---- Easy on the eyes ---- Smooth Darkness ---- Chestnut ---- Apple-ish Style ---- If Apples were blue ---- If Apples were green ---- If Apples were purple ---- Halloween 2007 ---- B&W ---- Halloween ---- AO Christmas Theme ---- Turkey Day Theme ---- AO 2007 beta ---- 4th Of July Contact Us - Actuarial Outpost - Archive - Privacy Statement - Top

Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
*PLEASE NOTE: Posts are not checked for accuracy, and do not
represent the views of the Actuarial Outpost or its sponsors.
Page generated in 0.24614 seconds with 10 queries