BookmarkSubscribeRSS Feed
Nikos
Fluorite | Level 6

Hi all,

I have the attached data file that shows monthly transactions grouped by the variable KEY_V.

Variables POS , NEG and QST are not included in my original dataset.

I want to create them based on the following assumptions:

1.- When AMT_1 = 0 across ALL records of the BY Group Vat KEY_V then var QST = 1 (by groups 1,2 & 3)

2.-  When AMT_1 = 0 and ANY of the other AMT_2, AMT_3, AMT_4 has a value different from zero then var QST = 2  (by groups  4,7,8,9)

3.-  a) When AMT_1 not equal to zero at the first record of the By Group then POS=1 and NEG=0  (and QST=0). The same pattern is followed until it hits the first record with AMT_1 = 0 then POS=0 and NEG=1 (and QST=0)

      b) Extending a) If right after we have more subsequent records with AMT_1 =0 then POS=0 and NEG=0 and

        QST =2 if ANY of the other AMT_2, AMT_3, AMT_4 has a value different from zero

      or

        QST =3 if ALL of the other AMT_2, AMT_3, AMT_4 equal 0 (by groups  7,9)

Finally I would like to to summarize the counts for POS, NEG and QST both simple counts and CUMULATIVE By ORG_YEAR  (as a column ) and TRNS_QTR (as a row).

Any suggestions or hints will be more than welcome.

Thank you in advance

Nik

2 REPLIES 2
ballardw
Super User

Isn't by group 4 in pattern 3? The first value for AMT_1 is not 0. If not your descriptions for pattern 2 needs more clarification.

Nikos
Fluorite | Level 6

QST takes the value 2 under more than one assumption

Thank you

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 777 views
  • 0 likes
  • 2 in conversation