SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

SAS EG program window

Reply
Occasional Contributor
Posts: 11

SAS EG program window

Hi, I am looking for macro that sums up the variable column

Just to give an example : here is the table col names

Product. jan, Feb ...Dec

Months are the variable columns and the table changes every month, as in e.g in the month of Feb, Jan column gets dropped and so on for the March month.

The objective of the macro is to create two new columns current month and rest of the month(summed up)

Thanks in advance


SAS Moderator
Posts: 55

Re: SAS EG program window [how to improve your question]

Hello @Ramabc3,


Your question requires more details before experts can help. Can you revise your question to include more information? 

 

Review this checklist:

  • Specify a meaningful subject line for your topic.  Avoid generic subjects like "need help," "SAS query," or "urgent."
  • When appropriate, provide sample data in text or DATA step format.  See this article for one method you can use.
  • If you're encountering an error in SAS, include the SAS log or a screenshot of the error condition. Use the Photos button to include the image in your message.
    use_buttons.png
  • It also helps to include an example (table or picture) of the result that you're trying to achieve.

To edit your original message, select the "blue gear" icon at the top of the message and select Edit Message.  From there you can adjust the title and add more details to the body of the message.  Or, simply reply to this message with any additional information you can supply.

 

edit_post.png

SAS experts are eager to help -- help them by providing as much detail as you can.

 

This prewritten response was triggered for you by fellow SAS Support Communities member @KurtBremser

.
Occasional Contributor
Posts: 11

Re: SAS EG program window

Here is the data

Product Jan Feb
Xyz. 200. 100
AAA. 100. 200

I want to store Jan in a column called currentMonth and Jan + Feb in the ROY column.

Next month I will get a freah sent of the above table from Feb onwards

Feb should be stored in Current Month and the rest of the months in ROY.

Hope this is clear
Occasional Contributor
Posts: 11

Re: SAS EG program window

ProductAprMayJunJul AugSepOctNovDecCur_monthROY
A121421121115
B231421121217
C231421121217
D231421121217

 

 

Column Named "Cur_Month" and "ROY" is what I want to calculate.

 

As I have already mentioned, this table is dynamic...next month I will have data starting from May to Dec, in which case it will have to store May numbers in the Cur_Month and the rest of the months in ROY as a Sum(Jun+July+Aug+Sep+Oct+Nov+Dec)

 

Please note : I am using SAS Enterprise guide 7.1....I an use the program window to write the code or macro.

 

Thanks

Ramaa

Ask a Question
Discussion stats
  • 3 replies
  • 141 views
  • 0 likes
  • 2 in conversation