I am trying to convert a datetime variable to NLADATMYWw. fomat as shown in the picture below (query properties) by using the SAS VA Data Preparation tool
When I preview this query and view the results within the Data Preparation application, it looks like this (Results of query), which is exactly the format I want it to be in (Calendar week followed by a year).
When I run the query and try to open the newly generated table in either the Exploration or Report Designer application, it converts to a year format (see below, Datetime Format in Exploration). I have no options to change the format within the Exploration or Report Designer application back to what I want (I know that you can change the format, but the Calendar week, Year option is not avaliable).
Is there any reason why this the Exploration or Report Designed application would change this to a year format rather than keep the format I specified in the query? I would like to separate a bunch of data by calendar week so the NLADATMYWw. format is perfect for me, but just doesn't seem to stay in that format in the other SAS VA applications.
Hi,
You could create the formatted week yourself.
First create a calculated item _WeekNumber
_WeekNumber = WeekNumber('ENTRY_DATE'n)
Then create the formatted week as a new calculated item.
Formatted Week =
Concatenate('week ', Concatenate(Concatenate(Format('_WeekNumber'n, 'BEST2.'), ' '), Format('ENTRY_DATE'n[Raw], 'YEAR4.')))
I will have to try this! Do you know if this concatenated item will still be a datetime format? I would like for it to remain that way so I can utilize it in a time series animation
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.
Find more tutorials on the SAS Users YouTube channel.