I cannot re-create your issue using SAS 9.4M8.
How was the CHE libref defined? Is it pointing to a directory with SAS datasets? Or something else, like a foreign database? What happens if you change them both to using the same case for the dataset name (one is using CHE.COHORT and the other has CHE.cohort (lowercase)? It should NOT matter, but perhaps if your libref CHE is not pointing at a library of SAS datasets then perhaps it does matter.
Also is there anything strange about the name of the variable that seems to go missing?
73 %put &=sysvlong ;
SYSVLONG=9.04.01M8P022223
74 filename csv1 temp;
75 filename csv2 temp;
76
77 PROC EXPORT
78 DATA=sashelp.class(where=(age=12) keep=name age sex)
79 DBMS=CSV
80 OUTFILE=csv1 replace
81 ;
82 RUN;
NOTE: Unable to open parameter catalog: SASUSER.PARMS.PARMS.SLIST in update mode. Temporary parameter values will be saved to
WORK.PARMS.PARMS.SLIST.
83 /**********************************************************************
84 * PRODUCT: SAS
85 * VERSION: 9.4
86 * CREATOR: External File Interface
87 * DATE: 01JUN26
88 * DESC: Generated SAS Datastep Code
89 * TEMPLATE SOURCE: (None Specified.)
90 ***********************************************************************/
91 data _null_;
92 %let _EFIERR_ = 0; /* set the ERROR detection macro variable */
93 %let _EFIREC_ = 0; /* clear export record count macro variable */
94 file CSV1 delimiter=',' DSD DROPOVER ;
95 if _n_ = 1 then /* write column names or labels */
96 do;
97 put
98 "Name"
99 ','
100 "Sex"
101 ','
102 "Age"
103 ;
104 end;
105 set SASHELP.CLASS(where=(age=12) keep=name age sex) end=EFIEOD;
106 format Name $8. ;
107 format Sex $1. ;
108 format Age best12. ;
109 do;
110 EFIOUT + 1;
111 put Name $ @;
112 put Sex $ @;
113 put Age ;
114 ;
115 end;
116 if _ERROR_ then call symputx('_EFIERR_',1); /* set ERROR detection macro variable */
117 if EFIEOD then call symputx('_EFIREC_',EFIOUT);
118 run;
NOTE: The file CSV1 is:
Filename=/saswork/SAS_work7E2E0001F819_odaws02-usw2.oda.sas.com/#LN00192,
Owner Name=tom.abernathy,Group Name=oda,
Access Permission=-rw-r--r--,
Last Modified=31May2026:21:51:56
NOTE: 6 records were written to the file CSV1.
The minimum record length was 9.
The maximum record length was 12.
NOTE: There were 5 observations read from the data set SASHELP.CLASS.
WHERE age=12;
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
5 records created in CSV1 from SASHELP.CLASS.
NOTE: "CSV1" file was successfully created.
NOTE: PROCEDURE EXPORT used (Total process time):
real time 0.02 seconds
cpu time 0.02 seconds
119
120 PROC EXPORT
121 DATA=sashelp.class(keep=name age sex where=(age=12) )
122 DBMS=CSV
123 OUTFILE=csv2 replace
124 ;
125 RUN;
NOTE: Unable to open parameter catalog: SASUSER.PARMS.PARMS.SLIST in update mode. Temporary parameter values will be saved to
WORK.PARMS.PARMS.SLIST.
126 /**********************************************************************
127 * PRODUCT: SAS
128 * VERSION: 9.4
129 * CREATOR: External File Interface
130 * DATE: 01JUN26
131 * DESC: Generated SAS Datastep Code
132 * TEMPLATE SOURCE: (None Specified.)
133 ***********************************************************************/
134 data _null_;
135 %let _EFIERR_ = 0; /* set the ERROR detection macro variable */
136 %let _EFIREC_ = 0; /* clear export record count macro variable */
137 file CSV2 delimiter=',' DSD DROPOVER ;
138 if _n_ = 1 then /* write column names or labels */
139 do;
140 put
141 "Name"
142 ','
143 "Sex"
144 ','
145 "Age"
146 ;
147 end;
148 set SASHELP.CLASS(keep=name age sex where=(age=12) ) end=EFIEOD;
149 format Name $8. ;
150 format Sex $1. ;
151 format Age best12. ;
152 do;
153 EFIOUT + 1;
154 put Name $ @;
155 put Sex $ @;
156 put Age ;
157 ;
158 end;
159 if _ERROR_ then call symputx('_EFIERR_',1); /* set ERROR detection macro variable */
160 if EFIEOD then call symputx('_EFIREC_',EFIOUT);
161 run;
NOTE: The file CSV2 is:
Filename=/saswork/SAS_work7E2E0001F819_odaws02-usw2.oda.sas.com/#LN00193,
Owner Name=tom.abernathy,Group Name=oda,
Access Permission=-rw-r--r--,
Last Modified=31May2026:21:51:56
NOTE: 6 records were written to the file CSV2.
The minimum record length was 9.
The maximum record length was 12.
NOTE: There were 5 observations read from the data set SASHELP.CLASS.
WHERE age=12;
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
5 records created in CSV2 from SASHELP.CLASS.
NOTE: "CSV2" file was successfully created.
NOTE: PROCEDURE EXPORT used (Total process time):
real time 0.02 seconds
cpu time 0.03 seconds
Also why did you not get the NOTE about not being able to write to SASUSER library? Are you accidentally running SAS without the RSASUSER option?
... View more