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

DW Simpson Global Actuarial & Analytics Recruitment
Download our 2017 Actuarial Salary Survey
now with state-by-state salary information!


Reply
 
Thread Tools Search this Thread Display Modes
  #81  
Old 03-08-2012, 11:41 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,708
Blog Entries: 2
Default

On the surface, your syntax is correct. First thing to check is if variable1 is numeric and variable2 is character. Assuming those things are not the source of the error, can you tell us what the error is? Can you post relevant info from the log?
__________________
If at first you don't succeed, you have one data point.
Res ipsa loquitur, sed quid in infernos dicet?
Reply With Quote
  #82  
Old 03-08-2012, 11:44 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,708
Blog Entries: 2
Default

Quote:
Originally Posted by Kmc View Post
SAS doesn't use the Like operator (except in proc sql). Instead you would do "substr(variable2,1,3)='bri';"
Not true. SAS can accept the Like operator in a Where clause in a Data step, as infinity8 used it.
__________________
If at first you don't succeed, you have one data point.
Res ipsa loquitur, sed quid in infernos dicet?
Reply With Quote
  #83  
Old 03-08-2012, 01:17 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,151
Default

Quote:
Originally Posted by infinity8 View Post
I'm new to SAS, trying to find resources online. I am trying to filter my data set as follows...

data temptable;
set dataset;
where variable1 = 28 and variable2 like 'bri%';
run;

I am getting errors. Does anyone know why? I believe im doing the wildcard stuff wrong.
I think the wildcard is *. It's definitely not %, which is protected for Macro usage
__________________
ADoubleDot: I'm an actuarial icon.

**** Juan.
Reply With Quote
  #84  
Old 03-08-2012, 01:30 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

Quote:
Originally Posted by ADoubleDot View Post
I think the wildcard is *. It's definitely not %, which is protected for Macro usage
Nope. The wildcard is the percent sign.

Here's a simple example. Try it yourself:
Code:

data a;set sashelp.zipcode;
where city like 'Chica%';
run;
Here's the log:
Code:
50 data a;set sashelp.zipcode;
51 where city like 'Chica%';
52 run;
NOTE: There were 87 observations read from the data set SASHELP.ZIPCODE.
WHERE city like 'Chica%';
NOTE: The data set WORK.A has 96 observations and 23 variables.
NOTE: DATA statement used (Total process time):
real time 0.06 seconds
cpu time 0.06 seconds
__________________
If at first you don't succeed, you have one data point.
Res ipsa loquitur, sed quid in infernos dicet?
Reply With Quote
  #85  
Old 03-08-2012, 01:42 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,151
Default

well i'll be
__________________
ADoubleDot: I'm an actuarial icon.

**** Juan.
Reply With Quote
  #86  
Old 03-09-2012, 02:50 PM
T-roy's Avatar
T-roy T-roy is offline
Member
SOA
 
Join Date: May 2002
College: UW Whitewater
Favorite beer: FFF GBH/NG Moon Man
Posts: 8,768
Blog Entries: 1
Default

In a data step, I want to have the order of my variables that I select in the keep statement to be in that order. any easy way of doing that?
__________________
Quote:
Originally Posted by ORLYLOL View Post
Beer is ****ing amazing
Reply With Quote
  #87  
Old 03-09-2012, 02:58 PM
CuriousGeorge CuriousGeorge is offline
Member
CAS SOA
 
Join Date: Dec 2005
Posts: 1,288
Default

Quote:
Originally Posted by T-roy Boy View Post
In a data step, I want to have the order of my variables that I select in the keep statement to be in that order. any easy way of doing that?
Try defining them (e.g. with format) before the set statement.
Reply With Quote
  #88  
Old 03-09-2012, 02:59 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

data newtable;
attrib var5 var3 var4 var1 var2;
set prevtable;
run;
__________________
If at first you don't succeed, you have one data point.
Res ipsa loquitur, sed quid in infernos dicet?
Reply With Quote
  #89  
Old 03-09-2012, 03:00 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

Quote:
Originally Posted by CuriousGeorge View Post
Try defining them (e.g. with format) before the set statement.
Format requires knowledge of the right format ahead of time. Attrib or Retain can be used without any side affects or requiring a priori knowledge of the data.
__________________
If at first you don't succeed, you have one data point.
Res ipsa loquitur, sed quid in infernos dicet?
Reply With Quote
  #90  
Old 03-09-2012, 03:15 PM
T-roy's Avatar
T-roy T-roy is offline
Member
SOA
 
Join Date: May 2002
College: UW Whitewater
Favorite beer: FFF GBH/NG Moon Man
Posts: 8,768
Blog Entries: 1
Default

Quote:
Originally Posted by BassFreq View Post
data newtable;
attrib var5 var3 var4 var1 var2;
set prevtable;
run;
I used this but it gives me this error:

ERROR 22-322: Syntax error, expecting one of the following: a name, -, :, FORMAT, INFORMAT, LABEL, LABLE, LENGTH, TRANSCODE, _ALL_,
_CHARACTER_, _CHAR_, _NUMERIC_.
__________________
Quote:
Originally Posted by ORLYLOL View Post
Beer is ****ing amazing
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 03:01 PM.


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