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

PROC SQL;
/* Entwicklung */
   CREATE TABLE TEMP AS  
   SELECT case    when t1.KONTO_ID in (&Nostrokonten)  
                    then 0 /* Nostrokonten */
                else t2.MLR_ProduktgruppeID
                end as MLR_ProduktgruppeID  format=mlr_produktgruppe.,  
                sum(Bilanzsaldo) as Bilanzsaldo format=commax18.2,
            t1.Stichtag
      FROM S1_KONTO&stichtag t1  
          LEFT JOIN DB.MAPPING_GAB2MLR_PRODUKTGRUPPE t2
        ON t1.GAB = t2.GAB
      GROUP BY MLR_ProduktgruppeID,
               Stichtag;
quit;

1 ACCEPTED SOLUTION

Accepted Solutions
Jeremy_Browne
Fluorite | Level 6

Either use an alias for the case statement that is not the same as the variable (t2.)MLR_ProduktgruppeID: i.e. ..AS MLR_ProduktgruppeID_2 and use the alias in the GROUP BY.  Ambiguity between VAR and alias may be the issue AND/OR if that doesn't fix, also put the CASE statement longhand in the GROUP BY (without the AS...) 

View solution in original post

1 REPLY 1
Jeremy_Browne
Fluorite | Level 6

Either use an alias for the case statement that is not the same as the variable (t2.)MLR_ProduktgruppeID: i.e. ..AS MLR_ProduktgruppeID_2 and use the alias in the GROUP BY.  Ambiguity between VAR and alias may be the issue AND/OR if that doesn't fix, also put the CASE statement longhand in the GROUP BY (without the AS...) 

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 1 reply
  • 1073 views
  • 0 likes
  • 2 in conversation