I use the windowing environment on my local machine, and if you go to the "run" tab there is an option for "recall last submit". It places the requested code above what you just submitted.
Alternatively, if you use an IDE that supports regular expression searches, you can remove them there. I use Visual Studio Code for other languages (it does have a SAS supported language mode), and I often use it for things like this.
I pasted this into Visual Studio (the output of a PROC IMPORT)
79 /**********************************************************************
80 * PRODUCT: SAS
81 * VERSION: 9.4
82 * CREATOR: External File Interface
83 * DATE: 07OCT21
84 * DESC: Generated SAS Datastep Code
85 * TEMPLATE SOURCE: (None Specified.)
86 ***********************************************************************/
87 data WORK.GNV_CRASHES (rename = (total_bycicles = total_bicycles)) ;
88 %let _EFIERR_ = 0; /* set the ERROR detection macro variable */
89 infile GNVCRSH delimiter = ',' MISSOVER DSD firstobs=2 ;
90 informat Case_Number best32. ;
91 informat DHSMV_Number best32. ;
92 informat Crash_Date mmddyy10. ;
93 informat Crash_Hour_of_Day best32. ;
94 informat Crash_minutes best32. ;
95 informat Crash_Day_of_Week $9. ;
96 informat Address $41. ;
97 informat Street_Address_number $10. ;
98 informat Intersect_Type $28. ;
99 informat Distance $11. ;
100 informat Street_Direction $1. ;
101 informat At_From_Intersection $38. ;
102 informat Total_People best32. ;
103 informat Total_Bycicles best32. ;
104 informat Total_Pedestrians best32. ;
105 informat Total_Vehicles best32. ;
106 informat Total_Mopeds best32. ;
107 informat Total_Motorcycles best32. ;
108 informat Total_Buses best32. ;
109 informat Total_Fatalities best32. ;
110 informat Geox best32. ;
111 informat Geoy best32. ;
112 informat Longitude best32. ;
113 informat Latitude best32. ;
114 informat Location $45. ;
115 informat City $11. ;
116 informat State $7. ;
117 format Case_Number best12. ;
118 format DHSMV_Number best12. ;
119 format Crash_Date mmddyy10. ;
120 format Crash_Hour_of_Day best12. ;
121 format Crash_minutes best12. ;
122 format Crash_Day_of_Week $9. ;
123 format Address $41. ;
124 format Street_Address_number $10. ;
125 format Intersect_Type $28. ;
126 format Distance $11. ;
127 format Street_Direction $1. ;
128 format At_From_Intersection $38. ;
129 format Total_People best12. ;
130 format Total_Bycicles best12. ;
131 format Total_Pedestrians best12. ;
132 format Total_Vehicles best12. ;
133 format Total_Mopeds best12. ;
134 format Total_Motorcycles best12. ;
135 format Total_Buses best12. ;
136 format Total_Fatalities best12. ;
137 format Geox best12. ;
138 format Geoy best12. ;
139 format Longitude best12. ;
140 format Latitude best12. ;
141 format Location $45. ;
142 format City $11. ;
143 format State $7. ;
144 input
145 Case_Number
146 DHSMV_Number
147 Crash_Date
148 Crash_Hour_of_Day
149 Crash_minutes
150 Crash_Day_of_Week $
151 Address $
152 Street_Address_number $
153 Intersect_Type $
154 Distance $
155 Street_Direction $
156 At_From_Intersection $
157 Total_People
158 Total_Bycicles
159 Total_Pedestrians
160 Total_Vehicles
161 Total_Mopeds
162 Total_Motorcycles
163 Total_Buses
164 Total_Fatalities
165 Geox
166 Geoy
167 Longitude
168 Latitude
169 Location $
170 City $
171 State $
172 ;
173 if _ERROR_ then call symputx('_EFIERR_',1); /* set ERROR detection macro variable */
174 run;
I then threw it into Visual Studio and clicked CTRL+F, which activates the find feature. There's a symbol for regular expressions (circled below):
I then used that regular expression (\d+\s+) and replaced it with nothing (replace field is blank). It provided me this:
/**********************************************************************
* PRODUCT: SAS
* VERSION: 9.4
* CREATOR: External File Interface
* DATE: 07OCT21
* DESC: Generated SAS Datastep Code
* TEMPLATE SOURCE: (None Specified.)
***********************************************************************/
data WORK.GNV_CRASHES (rename = (total_bycicles = total_bicycles)) ;
%let _EFIERR_ = 0; /* set the ERROR detection macro variable */
infile GNVCRSH delimiter = ',' MISSOVER DSD firstobs=;
informat Case_Number best32. ;
informat DHSMV_Number best32. ;
informat Crash_Date mmddyy10. ;
informat Crash_Hour_of_Day best32. ;
informat Crash_minutes best32. ;
informat Crash_Day_of_Week $9. ;
informat Address $41. ;
informat Street_Address_number $10. ;
informat Intersect_Type $28. ;
informat Distance $11. ;
informat Street_Direction $1. ;
informat At_From_Intersection $38. ;
informat Total_People best32. ;
informat Total_Bycicles best32. ;
informat Total_Pedestrians best32. ;
informat Total_Vehicles best32. ;
informat Total_Mopeds best32. ;
informat Total_Motorcycles best32. ;
informat Total_Buses best32. ;
informat Total_Fatalities best32. ;
informat Geox best32. ;
informat Geoy best32. ;
informat Longitude best32. ;
informat Latitude best32. ;
informat Location $45. ;
informat City $11. ;
informat State $7. ;
format Case_Number best12. ;
format DHSMV_Number best12. ;
format Crash_Date mmddyy10. ;
format Crash_Hour_of_Day best12. ;
format Crash_minutes best12. ;
format Crash_Day_of_Week $9. ;
format Address $41. ;
format Street_Address_number $10. ;
format Intersect_Type $28. ;
format Distance $11. ;
format Street_Direction $1. ;
format At_From_Intersection $38. ;
format Total_People best12. ;
format Total_Bycicles best12. ;
format Total_Pedestrians best12. ;
format Total_Vehicles best12. ;
format Total_Mopeds best12. ;
format Total_Motorcycles best12. ;
format Total_Buses best12. ;
format Total_Fatalities best12. ;
format Geox best12. ;
format Geoy best12. ;
format Longitude best12. ;
format Latitude best12. ;
format Location $45. ;
format City $11. ;
format State $7. ;
input
Case_Number
DHSMV_Number
Crash_Date
Crash_Hour_of_Day
Crash_minutes
Crash_Day_of_Week $
Address $
Street_Address_number $
Intersect_Type $
Distance $
Street_Direction $
At_From_Intersection $
Total_People
Total_Bycicles
Total_Pedestrians
Total_Vehicles
Total_Mopeds
Total_Motorcycles
Total_Buses
Total_Fatalities
Geox
Geoy
Longitude
Latitude
Location $
City $
State $
;
if _ERROR_ then call symputx('_EFIERR_',1); /* set ERROR detection macro variable */
run;
I don't do this often, so this isn't really vetted. It just seemed to work in this scenario. It could be problematic if you have that pattern pop up again in some code somehow.
... View more