Kick-start Your Data Exploration Journey with SAS Information Catalog
Recent Library Articles
Recently in the SAS Community Library: @smanoj introduces you to the SAS Information Catalog, which provides a powerful search engine to find needed data assets.
proc sql; create table laps_full as select A.*, B.ref_desc from laps As A left join reason_ref as B on (B.ref_code = A.rsn_cd and A.src_app_cd = B.src_type_code) ; quit; can someone please help me understand why I get the error. I checked the view with alias B and all the columns are present in that view.
... View more
Hi,
I have this table:
DATA HAVE;
INPUT CATEGORY TYPE$ INV_M1 INV_M2 INV_M3 ;
CARDS;
1 A 5 5 9
1 B 10 2 2
2 A 2 2 3
2 B 6 6 5
3 A 8 7 9
3 B 4 9 8
4 A 10 8 9
4 B 5 2 1
;
RUN;
For each CATEGORY and for each month (M1,M2,M3), I have to calculate the following result (TYPE B / TYPE A)
The result should be this:
What function can I use ?
... View more
Boa tarde, tenho duas tabelas e gostaria de gerar/exportar um arquivo único, em que, cada tabela ficasse em uma aba do excel. Como fazer este procedimento?
... View more
Hi guys,
suppose to have the following:
data DB;
input ID :$20. Admission :date09. Discharge :date09. Index1 Index2;
format Admission date9. Discharge date9.;
cards;
0001 13JAN2017 25JAN2017 1 1
0001 22FEB2018 03MAR2018 0 1
0001 30JAN2019 04MAR2019 0 1
0002 01DEC2018 14DEC2018 1 1
0002 25DEC2018 02JAN2019 0 1
0003 09JAN2016 25JAN2016 1 1
0003 29JAN2018 12FEB2018 0 1
0004 02FEB2014 12MAR2014 1 0
0004 02DEC2018 11SEP2019 0 1
;run;
Is there a way to get the following?
data DB1;
input ID :$20. Admission :date09. Discharge :date09. Index1 Index2;
format Admission date9. Discharge date9.;
cards;
0001 13JAN2017 25JAN2017 1 1
0001 22FEB2018 03MAR2018 0 0
0001 30JAN2019 04MAR2019 0 0
0002 01DEC2018 14DEC2018 1 1
0002 25DEC2018 02JAN2019 0 0
0003 09JAN2016 25JAN2016 1 1
0003 29JAN2018 12FEB2018 0 0
0004 02FEB2014 12MAR2014 1 0
0004 02DEC2018 11SEP2019 0 1
;run;
In other words the column Index2 should be updated to have "1" only if "1" is present in column Index1 at the same row otherwise 0. This only if for each ID there is more than "1" in variable Index2 (i.e., "1" is repeated). For example, nothing should happen for ID 0004.
Thank you in advance
... View more
Brand new to SAS. I'm doing something that I expect is relatively easy, but I'm struggling to get it right. The requirement is basic - I'm reading in a long file with many rows, if a record matches a criteria I want it to be shipped to a different "bypass" file that I'll work on in a later process, but it should be removed from the original read-in file. Environment is zOS - input file is defined and passed in via JCL (all working). I get the following errors if I remove my actual logic - if I leave the FILENAME statement in without referencing it there's no errors. ERROR: Invalid logical name. ERROR: Error in the FILENAME statement. ERROR: Invalid file, BYPASS_FILE. FILENAME BYPASS_FILE BYPASS1;
/***********************************************************/
/* READ FILE */
/***********************************************************/
DATA DATAIN;
INFILE DATAIN;
INPUT
@ 00001 RECORD_NUMBER $CHAR8.
@ 01769 COMPONENT_STATUS $CHAR1.
;
/*******************************************************************/
/* CREATE BYPASS FILE - USED TO STORE RECORDS WHICH HAVE AN */
/* INACTIVE COMPONENT: COMPONENT_STATUS = I */
/*******************************************************************/
IF COMPONENT_STATUS = 'I' THEN DO;
FILE BYPASS_FILE;
PUT;
DELETE;
END;
... View more