BookmarkSubscribeRSS Feed
Cho8
Calcite | Level 5
Q420
6733.755169
.
571.4417845
.
363.2532938
.
0
.
0
.
126.4904378
.
18.189424

 

x=13857.20

I want to extract last in the Quarter, Quarter and year are changing dynamically. (i.e.Q320,Q420,Q120,Q220)

 

extract last record and add it to x.

6 REPLIES 6
PaigeMiller
Diamond | Level 26

Please explain further. I don't understand your words, and I don't see how they relate to the data you show.

--
Paige Miller
Cho8
Calcite | Level 5

everytime Quarter and year changes in Excel, i have to pickup the latest one..

 

if i give %let Q=Q320, then i have to pickup last record in that column and add it to another variable..instance X=18456.35..

 

 

PaigeMiller
Diamond | Level 26

@Cho8 wrote:

everytime Quarter and year changes in Excel, i have to pickup the latest one..

 

if i give %let Q=Q320, then i have to pickup last record in that column and add it to another variable..instance X=18456.35..

 

 


Show us a more complete data set, where we can see what you are talking about. Provide the data in a suitable form, which is this, and not screen captures or Excel documents.

 

And once we can see what you are talking about, explain the whole thing in detail so we can understand what you mean.

--
Paige Miller
Cho8
Calcite | Level 5
XYQ320Q420
59.70065040  
49.778459706103.4786733.755
3.635747240  
14.96771040359.6202571.4418
27.87488530  
66.26761870324.0891363.2533
58.1854010  
3.06299373038.697560
18.71581740  
55.9166339000
5.147375940  
363.2532940112.9771126.4904

 

 

The last records of every column to be added.

 

Quarter and year are changing everytime(for every input spreadsheet,but not x,y).

 

For instance %let Q1=Q320,Q2=Q420

PaigeMiller
Diamond | Level 26

@Cho8 , the best way to get help on this matter is to provide us the data in the desired form, rather than ignoring the request. I specifically stated what that was.

--
Paige Miller
Kurt_Bremser
Super User

The first issue I see here is that you hide data (dates) in structure (variable names), which makes coding for this complicated.

Please supply a more complete example of your data, and show us how your intended value x is built from the start.

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

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 1479 views
  • 0 likes
  • 3 in conversation