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-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—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
  • 1425 views
  • 1 like
  • 2 in conversation