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


Reply
 
Thread Tools Display Modes
  #1  
Old 08-26-2009, 12:19 PM
spencerhs5's Avatar
spencerhs5 spencerhs5 is offline
Member
 
Join Date: Jan 2007
Posts: 1,048
Default SAS and Database

lets say I have a table named Covtable in a database that contains two records with the column title CovCode.Here is the table:

CovCode
BI
CL


the libname statement is as follows

libname DBname oracle '...appropriate string to connect here'

the following works fine
/*start code */
proc contents data=DBname.covtable;
/*end*/

i would like to do something like the following
/*start code */
data NewTempdataset
infile dbname.covtable;
if covcode='BI' then Desc='Bodily' else Desc='Coll';

proc print data=newtempdataset;
run;
/*end*/

Any ideas? Thanks,
Reply With Quote
  #2  
Old 08-26-2009, 12:59 PM
ADoubleDot's Avatar
ADoubleDot ADoubleDot is online now
Member
 
Join Date: Nov 2007
Location: Slightly Dusty South
Studying for the rest of my life
Posts: 35,622
Default

data NewTempdataset
set dbname.covtable;
if covcode='BI' then Desc='Bodily';
else Desc='Coll';
run;

Not sure if you actually need the "set", i havent used infile since my class in school. But the If is two statements seperated by semi-colons. You need the run;.
__________________
def no_one(the_spanish_inquisition):

**** Juan.
Reply With Quote
  #3  
Old 08-26-2009, 01:22 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,213
Default

You definitely need the set and not the infile. Also need semicolon after the "data NewTempdataset" and before "set".

In this case, you do not need the run, since it is immediately followed by a proc, but having the run there is a little more standard than not.
__________________
Res ipsa loquitur, sed quid in infernos dicet?
Reply With Quote
  #4  
Old 08-26-2009, 01:30 PM
spencerhs5's Avatar
spencerhs5 spencerhs5 is offline
Member
 
Join Date: Jan 2007
Posts: 1,048
Default

thanks got it....its beeen a long time since ive used sas....
Reply With Quote
Reply

Thread Tools
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 03:45 PM.


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