/* Here's a trick I occasionally use. Note only one record is read form each dataset but SAS magic knows all… */ Data my_dataset ; do I=1 to 27 ; output ; end ; run ; Data my_dataset2 ; do I=1 to 73 ; output ; end ; run ; data _null_ ; set my_dataset(obs=1) nobs=nobs ; call symputx('records',nobs) ; run ; %put records: &records ; /* Here SAS knows how many obs are in the concatenated datasets too… */ data _null_ ; set my_dataset(obs=1) my_dataset2(obs=1) nobs=nobs ; call symputx('records',nobs) ; run ; %put Concatenated records: &records ; The Log file: NOTE: The data set WORK.MY_DATASET has 27 observations and 1 variables. NOTE: The data set WORK.MY_DATASET2 has 73 observations and 1 variables. NOTE: There were 1 observations read from the data set WORK.MY_DATASET. records: 27 NOTE: There were 1 observations read from the data set WORK.MY_DATASET. NOTE: There were 1 observations read from the data set WORK.MY_DATASET2. Concatenated records: 100
... View more