BookmarkSubscribeRSS Feed
sdixit
Obsidian | Level 7

Hi All,

 

Could someone assist me how I can read only the last day of the month data from my table .

 

Example :

 

I have a sql to pull the data from netezza table to SAS Based on the period dates which has daily data But i need to pull only the data

of last day of each month. How can i accomlipsed that in the sql pass through?

 

Period date

01jul

02jul

30jul==> need this data

01aug

02aug

03aug

31aug ==> need this data

 

Thanks

Shuchi

 

2 REPLIES 2
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Well, I don't know that database and its out o scope for this forum.  From a SAS standpoint you can filter the recieved data in a datastep after the sql, or you can go and investigate the database's functions and guidance and build a working SQL clause there.

 

Edit: logically the process is to group the data by month(date) and output when date=max(date) by month.  So first step would be to get month, maybe:

https://stackoverflow.com/questions/4500390/netezza-sql-extract-month-issue

kiranv_
Rhodochrosite | Level 12

there is last_day function in neteezza, which you can derive last day and then in your where clause you can say where last day = your day

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!

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