BookmarkSubscribeRSS Feed
wfiona020
Calcite | Level 5

 

 

As below my code, I have to create a table d, and then run it again to add a new column. 

My question is: Can I add the "GAP" directly in table d?

 

Thanks

 

PROC SQL;

       CREATE TABLE D AS

SELECT

       A.*,

       B.PRC_DAY_AFTER

FROM

       D_MERGER AS A, D_PRC AS B

WHERE A.DEALNO=B.DEALNO;

RUN;

 

DATA D_GAP;

      SET D;

            GAP=(INITIAL_OFFER-PRC_DAY_AFTER)/PRC_DAY_AFTER;

RUN;

 

1 REPLY 1
Tom
Super User Tom
Super User

Yes.

PROC SQL;
CREATE TABLE D AS
SELECT
        A.*
      , B.PRC_DAY_AFTER
      , (A.INITIAL_OFFER-B.PRC_DAY_AFTER)/B.PRC_DAY_AFTER as GAP
FROM D_MERGER AS A
   , D_PRC AS B
WHERE A.DEALNO=B.DEALNO
;
QUIT;

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

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