Desktop productivity for business analysts and programmers

Date Imported but Exports String

Accepted Solution Solved
Reply
Contributor
Posts: 36
Accepted Solution

Date Imported but Exports String

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!


Accepted Solutions
Solution
3 weeks ago
Super User
Super User
Posts: 7,723

Re: Date Imported but Exports String

 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


All Replies
Solution
3 weeks ago
Super User
Super User
Posts: 7,723

Re: Date Imported but Exports String

 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.

 

Highlighted
Contributor
Posts: 36

Re: Date Imported but Exports String

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!

☑ This topic is solved.

Need further help from the community? Please ask a new question.

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