Actuarial Outpost
 
Go Back   Actuarial Outpost > Actuarial Discussion Forum > Software & Technology
FlashChat Actuarial Discussion Preliminary Exams CAS/SOA Exams Cyberchat Around the World Suggestions


Fill in a brief DW Simpson Registration Form
to be contacted when new jobs meet your criteria.


Reply
 
Thread Tools Search this Thread Display Modes
  #131  
Old 01-10-2013, 06:49 PM
MountainGirl's Avatar
MountainGirl MountainGirl is offline
Badass
Non-Actuary
 
Join Date: Feb 2007
Location: in a van down by the river
Favorite beer: free
Posts: 13,223
Default

also, this is probably not a simple question for most SAS users.
__________________
What kind of dining set defines me as a person?

The things you own, end up owning you.
Reply With Quote
  #132  
Old 01-10-2013, 07:05 PM
dumples dumples is offline
Member
CAS
 
Join Date: Sep 2003
Posts: 1,247
Default

Quote:
Originally Posted by MountainGirl View Post
SAS is passing the numeric stuff fine, but whatever i try, the char var won't work. any ideas?


%let email_list = ("myemail@me.com");
%put &email_list;

filename doemail email to= &email_list
subject="ALERT: Your code is f*cked up"
from="me@me.com";

data _null_;
now = put(datetime(), datetime26.6);
charvar = &charvar;
cnt_1 = &cnt_1;
cnt_2 = &cnt_2;
file doemail;
put 'You got issues for ' charvar '. There were ' cnt_1 ' policies, but because your code sucks, there were ' cnt_2 'records. This was found @: EST ' NOW ;
run;


why is it that my numeric ones pass through fine, but for the character one... let's say that charvar = "Alabama".... my log says "NOTE: Variable Alabama is uninitialized." it doesn't do that for the numbers. they are all just macro vars. so why does it work for the numbers but not the words???
I'm sorry, but are the quotes part of the CharVar. I.E. is it a string that resolves to "Alabama" or a string that resolves to Alabama? Given your error, I would expect that it resolves without the quotes.

I think the solution is just :

charvar = "&charvar";

but it's been 2 years since I've done any SAS coding, so try it and let me know.
Reply With Quote
  #133  
Old 01-10-2013, 07:08 PM
MountainGirl's Avatar
MountainGirl MountainGirl is offline
Badass
Non-Actuary
 
Join Date: Feb 2007
Location: in a van down by the river
Favorite beer: free
Posts: 13,223
Default

Quote:
Originally Posted by dumples View Post
I'm sorry, but are the quotes part of the CharVar. I.E. is it a string that resolves to "Alabama" or a string that resolves to Alabama? Given your error, I would expect that it resolves without the quotes.

I think the solution is just :

charvar = "&charvar";

but it's been 2 years since I've done any SAS coding, so try it and let me know.
YES! you win 50 AO points!!


thanks!

i use "&charvar" all the time. don't know why i didn't think of that.
__________________
What kind of dining set defines me as a person?

The things you own, end up owning you.
Reply With Quote
  #134  
Old 07-02-2013, 03:39 PM
RhoRho RhoRho is offline
Member
 
Join Date: Oct 2010
Posts: 279
Default

I am having trouble with a merge. It seems when I split the following code into two different data statements I get differing results where the split is what I expected. However, if I lump the merge and manipulation in the same data statement I get some wonky answers.

Last edited by RhoRho; 07-02-2013 at 04:15 PM..
Reply With Quote
  #135  
Old 07-02-2013, 03:56 PM
ADoubleDot's Avatar
ADoubleDot ADoubleDot is offline
Member
SOA
 
Join Date: Nov 2007
Location: Slightly Dusty South
Studying for the rest of my life
Posts: 37,141
Default

I don't think you have given us enough information to help you. What are you trying to do?
__________________
ADoubleDot: I'm an actuarial icon.

**** Juan.
Reply With Quote
  #136  
Old 07-02-2013, 04:09 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,708
Blog Entries: 2
Default

Rhorho - try finding a specific policy where there is a difference between the data in WOP_for_Claims_1 and the resulting data from the other method. Limit the data in WOP_for_Claims and CY_Claims_Inc_1 down to that policy. Then, follow the data and see what happens in your merge.
__________________
If at first you don't succeed, you have one data point.
Res ipsa loquitur, sed quid in infernos dicet?
Reply With Quote
  #137  
Old 08-26-2013, 04:09 PM
Gareth Keenan's Avatar
Gareth Keenan Gareth Keenan is offline
Member
CAS
 
Join Date: Feb 2006
Location: by a pretty big bay
Studying for #9
Favorite beer: butter
Posts: 1,287
Default joining on two dates in a proc sql

I've got a kind of long proc sql I inherited and did not build myself. This is important, because this once proc sql create table joins 4 tables together to create on data set, and I haven't the foggiest how to recreate otherwise, and the source tables are pretty large, so it's much faster for the code to run while going to the tables once.

Anyways, in my Where clause, I have one date, call the column OLDDATE, which is I think just a number of the YYYYMMDD format, so it's not a date, just a numeric field with those 4 digits. I need to join on NEWDATE, which is a regular SAS Datetime format.

Anyone know how to set these equal in the Where clause of my proc sql? I tried Year(NEWDATE)||MONTH(NEWDATE)||DAY(NEWDATE) = OLDDATE , but the concatenation only works on character fields, which sort of makes sense.

Any suggestions?

Cheers,

Gareth Keenan
Reply With Quote
  #138  
Old 08-26-2013, 04:27 PM
1695814's Avatar
1695814 1695814 is offline
Member
SOA AAA
 
Join Date: Aug 2002
Studying for nothing. I quit.
Favorite beer: Root
Posts: 34,654
Default

I'll tell you what I've done with some things & you can see if it applies to your situation.

We use the standard format yyyy/mm/dd to store all of our dates. This allows us to read in each part as necessary.

Then it can be recombined to create a numeric variable as so:
DATENUM = YEAR * 10000 + MO * 100 + DAY;

YEAR, MO, & DAY are numeric, of course.

You could switch them to character using the PUT fn (PUT(YEAR,4.), etc.).

---

If you have the date parts & want a SAS date use the MDY fn: NEWDATE = MDY(MO,DAY,YEAR);

http://support.sas.com/onlinedoc/913/docMainpage.jsp
Quote:
MDY( month, day, year ) returns a SAS date value for month, day, and year values.
That might be enough to get you by. I'm sure there are other ways of going about it.
__________________
Sheep Dog Dare Game Champion


come...play FSP
Reply With Quote
  #139  
Old 08-26-2013, 05:24 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,708
Blog Entries: 2
Default

Gareth,

NEWDATE is datetime. If OLDDATE is date format, then you need to use the following condition for your join:

DATEPART(NEWDATE) = OLDDATE
__________________
If at first you don't succeed, you have one data point.
Res ipsa loquitur, sed quid in infernos dicet?
Reply With Quote
  #140  
Old 08-26-2013, 08:10 PM
Gareth Keenan's Avatar
Gareth Keenan Gareth Keenan is offline
Member
CAS
 
Join Date: Feb 2006
Location: by a pretty big bay
Studying for #9
Favorite beer: butter
Posts: 1,287
Default

OLDDATE is not of a date format, it's just 8 numbers, no trailing or preceding spaces.
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 04:31 AM.


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 1.28505 seconds with 10 queries