I have some code which I will post on here and sometimes I get an error when running it, then other times I don't. If I run the proc sql alone and then the data step alone, I get the error. If I run them together it will work sometimes. If I start off running them together it will error so I then revert to separate and it works. I have multiple data steps that have a point = and once I get the first to run, the others that remain never error. It is just the first time I open my program this happens. Not sure why. The error is:
ERROR: The POINT= data set option is not valid for the data set CARDIAC.TINRESTUDY, the data set
must be accessible by observation number for POINT= processing.
My code:
PROC SQL;*restudy tin;
CREATE TABLE cardiac.tinrestudy AS
(SELECT DISTINCT mbr_sys_id, fst_srvc_dt, prov_tin, prov_tin_pci, prov_tin_cath, prov_tin_ct,
prov_tin_secho, prov_tin_tee, prov_tin_tte, prov_tin_perf, prov_tin_pet, prov_tin_cabg,
office_clinic, inpatient_facility, outpatient_facility,
prov_tin_maj_restudy, prov_tin_min_restudy, prov_tin_fu_30, prov_tin_fu_182
FROM cardiac.final11b
WHERE MBR_SYS_ID IN
(SELECT DISTINCT MBR_SYS_ID FROM cardiac.final11b
where nat_pci>. and
fst_srvc_dt>. )
and fst_srvc_dt >. and prov_tin > ('000000000'));
run;
options compress=NO reuse=yes;
data cardiac.tinmaj;*maj restudies;
set cardiac.tinrestudy nobs=last_obs;
by mbr_sys_id ;
if prov_tin_pci=1 then do;
wb = fst_srvc_dt + 1;
we = fst_srvc_dt + 90;
do pt = _N_ + 1 to last_obs;
set cardiac.tinrestudy(keep= mbr_sys_id fst_srvc_dt prov_tin_ct prov_tin_cath
prov_tin_pet prov_tin_perf office_clinic inpatient_facility outpatient_facility
rename=(mbr_sys_id=mem fst_srvc_dt=dt prov_tin_ct = nct prov_tin_cath = ncath
prov_tin_pet=pet prov_tin_perf=nperf office_clinic=ofc
inpatient_facility=ip outpatient_facility=op))
point=pt;
if mbr_sys_id ne mem or dt > we then leave;
if dt >= wb and dt<=we and ofc=1 and ncath=1 then ofc_majcath = sum(ofc_majcath,ncath);
if dt >= wb and dt<=we and ip=1 and ncath=1 then ip_majcath= sum(ip_majcath,ncath);
if dt >= wb and dt<=we and op=1 and ncath=1 then op_majcath= sum(op_majcath,ncath);
if dt >= wb and dt<=we and ofc>=1 and nct>=1 then ofc_majct= sum(ofc_majct,nct);
if dt >= wb and dt<=we and ip>=1 and nct>=1 then ip_majct= sum(ip_majct,nct);
if dt >= wb and dt<=we and op>=1 and nct>=1 then op_majct= sum(op_majct,nct);
if dt >= wb and dt<=we and ofc>=1 and pet>=1 then ofc_majpet= sum(ofc_majpet,pet);
if dt >= wb and dt<=we and ip>=1 and pet>=1 then ip_majpet= sum(ip_majpet,pet);
if dt >= wb and dt<=we and op>=1 and pet>=1 then op_majpet= sum(op_majpet,pet);
if dt >= wb and dt<=we and ofc>=1 and nperf>=1 then ofc_majperf= sum(ofc_majperf,nperf);
if dt >= wb and dt<=we and ip>=1 and nperf>=1 then ip_majperf= sum(ip_majperf,nperf);
if dt >= wb and dt<=we and op>=1 and nperf>=1 then op_majperf= sum(op_majperf,nperf);
end;
output;
end;
if we =. then we=fst_srvc_dt;
if wb=' ' then wb=fst_srvc_dt;
if we=wb then output;
drop wb we mem dt nct ncath pet nperf pt ip ofc op prov_tin_pci prov_tin_cabg
office_clinic inpatient_facility outpatient_facility prov_tin_fu_30 prov_tin_fu_182
prov_tin_pci prov_tin_cath prov_tin_ct prov_tin_pet prov_tin_secho prov_tin_tee
prov_tin_tte prov_tin_perf prov_tin_min_restudy;
run;
Try moving the COMPRESS=NO system option before the SQL procedure or use cardiac.tinrestudy(POINTOBS=YES) when creating that dataset.
PG
Try moving the COMPRESS=NO system option before the SQL procedure or use cardiac.tinrestudy(POINTOBS=YES) when creating that dataset.
PG
That is the ticket. Thanks.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.