Actuarial Outpost Simple SAS Questions
 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

 Not looking for a job? Tell us about your ideal job, and we'll only contact you when it opens up. https://www.dwsimpson.com/register

#231
11-10-2017, 09:21 PM
 BassFreq Member CAS Join Date: Jun 2003 Location: Chicago Studying for all eternity Favorite beer: Duff Posts: 1,716 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, 09:21 PM
 NormalDan Member CAS Join Date: Dec 2016 Location: NJ Posts: 10,159

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, 09:32 PM
 Whiskey Member CAS Join Date: Jul 2008 Studying for nothing at all Posts: 40,938

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.

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, 11:32 AM
 ALivelySedative Member CAS Join Date: Dec 2013 Location: Land of the Pine College: UNC-Chapel Hill Alum Favorite beer: Red Oak Posts: 3,453

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.
__________________
Stuff | 6 | ACAS | FCAS stuff
#235
11-13-2017, 02:36 PM
 Childish Gambino Member SOA Join Date: Jul 2014 Posts: 32,037

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.
__________________
Quote:
 Originally Posted by Mitch McConnell We'll be working through this process, hopefully in a fairly short period of time, in total coordination with the White House counsel's office. ... Everything I do during this, I'm coordinating with the White House Counsel. There will be no difference between the President's position and our position.
#236
11-14-2017, 10:41 AM
 LICENSED TO ILL Member Join Date: Oct 2005 Posts: 937

The Array worked perfect! Thanks! everyone.
__________________
Spoiler:
Quote:
 Originally Posted by Loner Despite his name, LTI is squeaky clean and not harboring any diseases. Physical ones at least.
Quote:
 Originally Posted by OddSox this might be my favorite thread on the AO
#237
11-14-2017, 10:59 AM
 ALivelySedative Member CAS Join Date: Dec 2013 Location: Land of the Pine College: UNC-Chapel Hill Alum Favorite beer: Red Oak Posts: 3,453

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.
__________________
Stuff | 6 | ACAS | FCAS stuff
#238
11-20-2017, 11:19 AM
 LICENSED TO ILL Member Join Date: Oct 2005 Posts: 937

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 Loner Despite his name, LTI is squeaky clean and not harboring any diseases. Physical ones at least.
Quote:
 Originally Posted by OddSox this might be my favorite thread on the AO
#239
11-20-2017, 11:24 AM
 ALivelySedative Member CAS Join Date: Dec 2013 Location: Land of the Pine College: UNC-Chapel Hill Alum Favorite beer: Red Oak Posts: 3,453

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;```
__________________
Stuff | 6 | ACAS | FCAS stuff
#240
11-20-2017, 11:34 AM
 LICENSED TO ILL Member Join Date: Oct 2005 Posts: 937

oh my

__________________
Spoiler:
Quote:
 Originally Posted by Loner Despite his name, LTI is squeaky clean and not harboring any diseases. Physical ones at least.
Quote:
 Originally Posted by OddSox this might be my favorite thread on the AO