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

I imported an excel file that has two date columns (B,C). I then created a computed column that references two datastes. One, that I imported and another one, dataset B that has a date column of D).If the dateB in dataset A equals a date D in dataset B then I want dateC from dataset A to populate.  It does, but it populates as a string (20820)  instead of 01MAR2017.  If I look at datasetA after importing it shows up as 01MAR2017 and if I look at the dates in datasetB they also show up as 01MAR2017.  Why is the computed column going to a string format? 

In the computed column when I do the case statement it shows t1.'dateB'n  which I assumed was the reason but when I try to type in 't1.'dateB'd it errors.

Please help!

1 ACCEPTED SOLUTION

Accepted Solutions
RW9
Diamond | Level 26 RW9
Diamond | Level 26

 t1.'dateB'n - this has nothing to do with it.  '...'n refers to a variable using named literals (i.e. doesn't conform to SAS standards).

20820 - this is the numeric representation of a date.  Dates in SAS a numbers of days since a certain date, to display them in a date format, you would need to apply a date format for instance date9.

As for it being read in a character, that doesn't sound right as the date number is there, I assume you should just be able to apply a format to that variable.

 

View solution in original post

2 REPLIES 2
RW9
Diamond | Level 26 RW9
Diamond | Level 26

 t1.'dateB'n - this has nothing to do with it.  '...'n refers to a variable using named literals (i.e. doesn't conform to SAS standards).

20820 - this is the numeric representation of a date.  Dates in SAS a numbers of days since a certain date, to display them in a date format, you would need to apply a date format for instance date9.

As for it being read in a character, that doesn't sound right as the date number is there, I assume you should just be able to apply a format to that variable.

 

mmagnuson
Quartz | Level 8

The format worked. For some reason I picked a different date format and still spit out numbers but when I clicked Date9. it came out in the excel sheet as a date.

Thanks for the help!

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 638 views
  • 0 likes
  • 2 in conversation