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

I am trying to use the INTNX function within Proc SQL. I'd like it to convert my DATEVARIABLE to the first day of the week for a series of dates spanning several years. The coded I'm using is below.

PROC SQL;
SELECT intnx('week',DATEVARIABLE,0,'B') AS CalendarWeek
FROM Table
QUIT;

The issue I'm having is that it only returns null values. My expectations is that it would take any day of the week and output the beginning day (Sunday in this case).

 

Any suggestions to try would be helpful.

 

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

1. Are there any errors in your log

2. Do you have a date or datetime variable? If it's datetime variable use DTWEEK or WEEKDT as the interval not WEEK, sorry can't recall the order.

View solution in original post

3 REPLIES 3
Reeza
Super User

1. Are there any errors in your log

2. Do you have a date or datetime variable? If it's datetime variable use DTWEEK or WEEKDT as the interval not WEEK, sorry can't recall the order.

ewv
Obsidian | Level 7 ewv
Obsidian | Level 7

1. No errors in the log

2. It is a datetime variable! I'll try those options and report back shortly

ewv
Obsidian | Level 7 ewv
Obsidian | Level 7

DTWEEK did the trick. Thank you!

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!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 3 replies
  • 2173 views
  • 1 like
  • 2 in conversation