From ce331a23c8f2ec34dd30c1800ba1c7e02513a2dd Mon Sep 17 00:00:00 2001 From: Allan Bowe Date: Wed, 26 May 2021 23:35:25 +0300 Subject: [PATCH] fix: ensuring obs is updated when the table has zero columns --- base/mp_jsonout.sas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/base/mp_jsonout.sas b/base/mp_jsonout.sas index 0fe4dc0..6b3a9f3 100644 --- a/base/mp_jsonout.sas +++ b/base/mp_jsonout.sas @@ -102,7 +102,8 @@ %let fmtds=%scan(&syslast,2,.); /* prepare formats and varnames */ data _null_; - set &fmtds end=last; + if _n_=1 then call symputx('nobs',nobs,'l'); + set &fmtds end=last nobs=nobs; name=upcase(name); /* fix formats */ if type=2 or type=6 then do; @@ -128,7 +129,6 @@ call symputx(cats('len',_n_),newlen,'l'); call symputx(cats('fmt',_n_),fmt,'l'); call symputx(cats('type',_n_),type,'l'); - if last then call symputx('nobs',_n_,'l'); run; data &fmtds; /* rename on entry */