Actuarial Outpost
 
Go Back   Actuarial Outpost > Actuarial Discussion Forum > Software & Technology
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


Reply
 
Thread Tools Search this Thread Display Modes
  #151  
Old 10-01-2013, 09:22 AM
Gareth Keenan's Avatar
Gareth Keenan Gareth Keenan is offline
Member
CAS
 
Join Date: Feb 2006
Location: Garden State
Studying for #9
Favorite beer: butter
Posts: 1,308
Default

That's a good point, I had not considered hash join or another combination of SAS Steps would be more difficult to peer review. *sighs* Looks like I stick with left joins. Thanks BassFreq!
Reply With Quote
  #152  
Old 10-11-2013, 09:34 AM
sweetiepie sweetiepie is offline
Member
SOA
 
Join Date: Apr 2007
Location: 666 desdemona
Favorite beer: porters
Posts: 8,619
Blog Entries: 81
Default

GUYS GUYS my sas code ran last night! AND it gave me the results I wanted. I'm so happy.

For future reference, you can run macros in the middle of data steps by doing this:

%global allowed;
%macro qry(id,pd1,pd2);
proc sql;
select sum(allowed_am)
into :allowed
from Claims
where start_dt between &pd1 and &pd2
and csr_id = &id;
%mend;


data test;
set matchable;
rc=dosubl('%qry('||id||','||dt1||','||dt2||');
value=symget('allowed');
put value;
run;


Which makes more sense when you have a complicated data step that needs logic from a proc step... GAWD I miss VBA.

Last edited by sweetiepie; 10-11-2013 at 09:39 AM..
Reply With Quote
  #153  
Old 10-11-2013, 10:17 AM
BassFreq's Avatar
BassFreq BassFreq is offline
Member
CAS
 
Join Date: Jun 2003
Location: Chicago
Studying for all eternity
Favorite beer: Duff
Posts: 1,716
Blog Entries: 2
Default

Quote:
Originally Posted by sweetiepie View Post
data test;
set matchable;
rc=dosubl('%qry('||id||','||dt1||','||dt2||');
value=symget('allowed');
put value;
run;

... GAWD I miss VBA.
Sweetiepie, you don't even need the symget here. Macro variables are evaluated before the data step execution, so you only really need the symget function if you were altering the value of &allowed during the data step execution. You can get the same results with just
value=&allowed;

You might miss VBA now, but as you learn more SAS, you'll miss VBA less and less!
__________________
If at first you don't succeed, you have one data point.
Res ipsa loquitur, sed quid in infernos dicet?
Reply With Quote
  #154  
Old 10-11-2013, 10:55 AM
BassFreq's Avatar
BassFreq BassFreq is offline
Member
CAS
 
Join Date: Jun 2003
Location: Chicago
Studying for all eternity
Favorite beer: Duff
Posts: 1,716
Blog Entries: 2
Default

I hadn't noticed you were calling %dosubl!

I take it back, I think you would need to use symget().
__________________
If at first you don't succeed, you have one data point.
Res ipsa loquitur, sed quid in infernos dicet?
Reply With Quote
  #155  
Old 10-11-2013, 11:05 AM
sweetiepie sweetiepie is offline
Member
SOA
 
Join Date: Apr 2007
Location: 666 desdemona
Favorite beer: porters
Posts: 8,619
Blog Entries: 81
Default

Quote:
Originally Posted by BassFreq View Post
I hadn't noticed you were calling %dosubl!

I take it back, I think you would need to use symget().
Okay phew, that's what I thought.

I guess I should have posted an exmaple where it actually mattered.
Reply With Quote
  #156  
Old 10-23-2013, 03:26 PM
carolinacoast's Avatar
carolinacoast carolinacoast is offline
CAS SOA
 
Join Date: May 2013
Studying for FM/2
Posts: 10
Blog Entries: 3
Default

I have a very simple SAS question so I think it goes here.

I am creating an hbar graph and I have my goptions statement set up fine. However, I think my format statement is where I'm having trouble here. I am supposed to format the dates in my data set so that anything from 10/01/2012-10/31/2012 is labeled October and anything from 11/01/2012-11/30/2012 is labeled November. I have not learned how to do this yet, but I think there is some statement called a monname that could be of help when used in combination with proc format? I tried using it earlier and I got the error that the dates overlapped, which was impossible.


Any help is appreciated
Reply With Quote
  #157  
Old 10-23-2013, 03:31 PM
BassFreq's Avatar
BassFreq BassFreq is offline
Member
CAS
 
Join Date: Jun 2003
Location: Chicago
Studying for all eternity
Favorite beer: Duff
Posts: 1,716
Blog Entries: 2
Default

Prior to the proc that makes the graph, try the following:

Code:
 
data mydata;set mydata;
format mydatevar monname9.;
run;
Of course, change mydata to be the name of the data set you are graphing, and mydatevar to the name of the date variable you are using.

Does that fix it?
__________________
If at first you don't succeed, you have one data point.
Res ipsa loquitur, sed quid in infernos dicet?
Reply With Quote
  #158  
Old 10-23-2013, 04:01 PM
carolinacoast's Avatar
carolinacoast carolinacoast is offline
CAS SOA
 
Join Date: May 2013
Studying for FM/2
Posts: 10
Blog Entries: 3
Default

That worked great! Thanks

My only other question is that my final graph is involving economy class airline passengers that flew in particular months. The graph is by destination and then to be sorted again based on whether they flew in October or November. Well, my graph is graphing these correctly except for they are both being graphed in the same hbar (only separated by color). How can I make it so that if you look at the first destination you have one bar in one color for October and the line below is the different color bar for November (but still graphing the same destination)?
Reply With Quote
  #159  
Old 10-23-2013, 04:35 PM
BassFreq's Avatar
BassFreq BassFreq is offline
Member
CAS
 
Join Date: Jun 2003
Location: Chicago
Studying for all eternity
Favorite beer: Duff
Posts: 1,716
Blog Entries: 2
Default

Not sure.

I'm not that good with graphs.

But whenever I find myself in your situation (a few times a year or so), I turn to Mr. Rob Allison. His website ROCKS! I do not tire from looking at what he does with SAS graphs...Inspirational is all I can say.

Anyway, check out some of the graphs on his site, starting with these links:
http://robslink.com/SAS/democd6/aaaindex.htm
http://robslink.com/SAS/democd_hls/aaaindex.htm

Click on a thumbnail and you'll see the full output from SAS. Click on the link below the thumbnail and you'll see a brief explanation of the graph....and (most importantly) a link to the SAS code he used to produce it! Surf around and you'll likely see something that will come close to what you're trying to do. Look at his code, and adopt it to fit your needs.

Click the spoiler button to see an example of his SAS work -

Spoiler:
__________________
If at first you don't succeed, you have one data point.
Res ipsa loquitur, sed quid in infernos dicet?
Reply With Quote
  #160  
Old 10-23-2013, 04:45 PM
carolinacoast's Avatar
carolinacoast carolinacoast is offline
CAS SOA
 
Join Date: May 2013
Studying for FM/2
Posts: 10
Blog Entries: 3
Default

Wow that looks awesome. I'll be sure to check it out. Thanks for all of your help again
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 07:22 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, 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.26207 seconds with 10 queries