BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
chrissowden
Obsidian | Level 7

proc format;
    value $dest
        'DFW'='Dallas/Forth Worth'
        'LAX'='Los Angeles'
        'ORD'="O'Haire"
        'WAS'= 'DC-ALL Airports'
        'CDG'= 'De Gaulle'
        'CPH'= 'Copenhaugen'
        'FRA'='Frankfurt'
        'LHR'='London-Heathrow'
        'YYZ'='Toronto'    
    ;
run;

Proc SQL;
    create table ex1 AS
    select distinct s.state as Staff_State,s.empid,sup.state as SUP_Sate,p.jobcode, put(f.destination,$DEST.) AS dest,f.date
    from mysas.supervisors AS Sup
    
    full Join mysas.staffmaster AS s ON s.empid=sup.empid
    full Join mysas.payrollmaster as P ON s.empid=p.empid
    full join mysas.flightschedule as f ON s.empid=f.empid
    where destination in('CPH') and date ='04MAR2004'
    
    ;
quit;
   

when I try to select destination and the date I am getting an error in the log: date is a numeric value with date9. format.

 

_____
 ERROR: Expression using equals (=) has components that are of different data types.
 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
date ='04MAR2004'd

You need the d after the quotes to tell SAS it's a date, not a character field.

View solution in original post

1 REPLY 1
Reeza
Super User
date ='04MAR2004'd

You need the d after the quotes to tell SAS it's a date, not a character field.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 817 views
  • 1 like
  • 2 in conversation