Sas Proc Sql Innerjoin Returning No Columns
question was resolved Proc SQL not returning any columns. Innerjoin thanks to TOM. I appreciated the help offered here but it did not lead me to the correct solution. My original e
Solution 1:
Try this instead, removing any SAS specific functions/operations.
- Remove format
- Replace || with CONCAT() or COALESCE() as needed
proc sql;
connect to odbc (dsn='X' uid='X' pwd='XY');
create table School.TRANS_INFO asSELECT * from connection to odbc
(SELECTDistinct
S.Schd_t AS Schd_Date ,
S.otb As Ship_Loc,
W.store_NUMBER AS store,
S.SHP_ID AS SHIP_ID,
W.store_CITY_STATE,
Q.Stat_CD AS Status,
concat(S.PROD_CD, S.plt_CD) AS SKU,
coalesce(s.prod_cd, s.plt_cd as skU2,
W.ACCOUNT_TYPE as Location
FROM
SD.SHPMT_DTL S
INNER JOIN PN_store W ON W.store_NUMBER = S.Otb_DEST_store_NBR,
INNER JOIN SD.SHP_LEG Q ON Q.SHPMT_ID = S.SHP_ID,
WHERE
W.ACCOUNT_TYPE = 'I' AND S.Schd_t <= Sysdate
AND Q.Stat_CD IN ('S','P')ORDERBY Schd_Date);
disconnect from odbc;
QUIT;
I think MYSQL is using || as OR which should be equivalent to COALESCE()? In SAS that would be concatenation so not sure what you're trying to do here so I included both in my answer as SKU and SKU2.
Post a Comment for "Sas Proc Sql Innerjoin Returning No Columns"