BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi,

I have an Orderdate column with datetime as its datatype. I have to create three data items Orderyear, Ordermonthname and Ordermonthnumber in the SAS Information Map Studio.

Eg.
Orderdate : 01JUL2001:00:00:00

Orderyear : 2001
Ordermonthname : July
Ordermonthnumber : 07

I have created the Orderyear data item by configuring the format to DTYEAR under the Classification/Formats pane. It is working for me. I don’t know what format I have to specify for the data items Ordermonthname and Ordermonthnumber.

Kindly guide me to get my desired result.

Regards,
Sujeev
4 REPLIES 4
FredrikE
Rhodochrosite | Level 12
Try using functions instead:

data _null_;
a= "01JUL2001:00:00:00"dt ;
b = year(datepart(a));
c = put(month(datepart(a)),z2.);
d = put(day(datepart(a)),z2.);
put b= c= d=;
run;
deleted_user
Not applicable
Hi FredrikE,

Thanks for your response.

I still don't understand how i have to use this query inside the SAS Information Map Studio. I have given an example with Orderdate as mentioned in my previous post.

Actually, i have observation from the year 2001 to 2004. I have derived the columns Ordermonthnumber and Ordermonthname from the Orderdate column in the SAS Information Map Studio. If am using the query as mention by you, how i will pass the values for rest of the observations to the variable 'a'. I will use those columns in the SAS Web Report Studio to create reports.

Sorry, i am new to the SAS. Correct me if am wrong and kindly guide me.

Regards,
Sujeev
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
The code snippet provided in the reply is just an example of how to use a DATETIME variable to derive the other informational values you required, all based on the OrderDate. If you need to use additional data strings with year and/or month_name, you can derive these new variables with an expression that uses the correct SAS function, as was demonstrated in the previous reply.

The SAS-hosted documentation at the SAS support http://support.sas.com/ website is available and you can search the site using the website SEARCH facility or using something like the Google advanced search argument below:

enterprise guide using sas functions site:sas.com

With this search, you will find SAS-hosted documentation and also supplemental technical and conference topic-related reference material.

Scott Barry
SBBWorks, Inc.
deleted_user
Not applicable
Hi Scott Barry,

Thanks for your guidance. I'll check and let you know.

Regards,
Sujeev

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

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
  • 4 replies
  • 1486 views
  • 0 likes
  • 3 in conversation