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

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