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

Hi,

I am facing a challenge in getting two date values like Year and Week to be concatenated as YearWeek.

 

For example:

Year=2015

Week number = 1 To 52

Result needed is  a new varaible "Year_Weeknumber" = 201501, 201502 etc. in this format, displaying year and week number.

 

I have the year and weeknumber calculated in SAS from dates, but unable to concatenate them.

I am able to have yearMonth, YearQuarter values from date using Format, but did not find  "Year Weeknumber" option there.

 

Regards,

Abhi

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

If numeric use math

var=year*100+week;

 

if if you want a Character use catt

 

var=catt(year, put(week, z2.));

View solution in original post

2 REPLIES 2
Reeza
Super User

If numeric use math

var=year*100+week;

 

if if you want a Character use catt

 

var=catt(year, put(week, z2.));

abhilashatiwari
Obsidian | Level 7

Thank you so much Reeza..It works !!!

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

Tips for filtering data sources in SAS Visual Analytics

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.

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