@sasjs/core 4.56.1 → 4.57.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -237,6 +237,7 @@ If you find this library useful, please leave a [star](https://github.com/sasjs/
237
237
  The following repositories are also worth checking out:
238
238
 
239
239
  * [chris-swenson/sasmacros](https://github.com/chris-swenson/sasmacros)
240
+ * [Criptic/sas_snippets](https://github.com/Criptic/sas_snippets)
240
241
  * [greg-wotton/sas-programs](https://github.com/greg-wootton/sas-programs)
241
242
  * [KatjaGlassConsulting/SMILE-SmartSASMacros](https://github.com/KatjaGlassConsulting/SMILE-SmartSASMacros)
242
243
  * [paul-canals/toolbox](https://github.com/paul-canals/toolbox)
@@ -0,0 +1,436 @@
1
+ /**
2
+ @file
3
+ @brief Returns a mime type from a file extension
4
+ @details Provide a file extension and get a mime type.
5
+ The mappings were derived from this source:
6
+ https://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types
7
+
8
+
9
+
10
+ @param [in] ext The file extension (unquoted)
11
+ @return output The mime type
12
+
13
+ @version 9.2
14
+ @author Allan Bowe
15
+ **/
16
+
17
+ %macro mf_mimetype(
18
+ ext
19
+ )/*/STORE SOURCE*/ /minoperator mindelimiter=' ';
20
+
21
+ %let ext=%lowcase(&ext);
22
+
23
+ %if &ext in (sas txt text conf def list log)
24
+ %then %do;%str(text/plain)%end;
25
+ %else %if &ext=xlsx %then %do;
26
+ %str(application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)%end;
27
+ %else %if &ext in (xls xlm xla xlc xlt xlw)
28
+ %then %do;%str(application/vnd.ms-excel)%end;
29
+ %else %if &ext=xlsm
30
+ %then %do;%str(application/vnd.ms-excel.sheet.macroenabled.12)%end;
31
+ %else %if &ext=xlsb
32
+ %then %do;%str(application/vnd.ms-excel.sheet.binary.macroenabled.12)%end;
33
+ %else %if &ext in (css csv html n3 sgml vcard)
34
+ %then %do;%str(text/&ext)%end;
35
+ %else %if &ext in (avif bmp cgm gif ief jxl ktx png sgi tiff webp)
36
+ %then %do;%str(image/&ext)%end;
37
+ %else %if &ext in (exi gxf ipfix json mbox mp21 mxf oda oxps pdf rtf sdp wasm
38
+ xml yang zip)
39
+ %then %do;%str(application/&ext)%end;
40
+ %else %if &ext in (jpeg jpg jpe) %then %do;%str(image/jpeg)%end;
41
+ %else %if &ext in (mp4 mp4v mpg4) %then %do;%str(video/mp4)%end;
42
+ %else %if &ext in (otf ttf woff woff2) %then %do;%str(font/&ext)%end;
43
+ %else %if &ext in (mpeg mpg mpe m1v m2v)
44
+ %then %do;%str(video/mpeg)%end;
45
+ %else %if &ext in (h261 h263 h264 jpm mj2 webm)
46
+ %then %do;%str(video/&ext)%end;
47
+ %else %if &ext in (f4v fli flv m4v mng smv)
48
+ %then %do;%str(video/x-&ext)%end;
49
+ %else %if &ext in (3ds cmx pcx rgb tga)
50
+ %then %do;%str(image/x-&ext)%end;
51
+ %else %if &ext in (asm nfo opml sfv)
52
+ %then %do;%str(text/x-&ext)%end;
53
+ %else %if &ext in (aac caf flac wav)
54
+ %then %do;%str(audio/x-&ext)%end;
55
+ %else %if &ext in (ts m2t m2ts mts)
56
+ %then %do;%str(video/mp2t)%end;
57
+ %else %if &ext in (pfa pfb pfm afm)
58
+ %then %do;%str(application/x-font-type1)%end;
59
+ %else %if &ext in (oga ogg spx opus)
60
+ %then %do;%str(audio/ogg)%end;
61
+ %else %if &ext in (mid midi kar rmi)
62
+ %then %do;%str(audio/midi)%end;
63
+ %else %if &ext in (onetoc onetoc2 onetmp onepkg)
64
+ %then %do;%str(application/onenote)%end;
65
+ %else %if &ext in (mxml xhvml xvml xvm)
66
+ %then %do;%str(application/xv+xml)%end;
67
+ %else %if &ext in (f for f77 f90)
68
+ %then %do;%str(text/x-fortran)%end;
69
+ %else %if &ext in (wmf wmz emf emz)
70
+ %then %do;%str(application/x-msmetafile)%end;
71
+ %else %if &ext in (exe dll com bat msi)
72
+ %then %do;%str(application/x-msdownload)%end;
73
+ %else %if &ext in (bin dms lrf mar so dist distz pkg bpk dump elc deploy)
74
+ %then %do;%str(application/octet-stream)%end;
75
+ %else %if &ext in (atom atomcat atomsvc ccxml davmount emma gml gpx inkml mads
76
+ mathml metalink mets mods omdoc pls rdf rsd rss sbml shf smil sru ssdl ssml
77
+ tei wsdl wspolicy xaml xenc xhtml xop xslt xspf yin)
78
+ %then %do;%str(application/&ext+xml)%end;
79
+ %else %if &ext in (dir dcr dxr cst cct cxt w3d fgd swa)
80
+ %then %do;%str(application/x-director)%end;
81
+ %else %if &ext in (z1 z2 z3 z4 z5 z6 z7 z8)
82
+ %then %do;%str(application/x-zmachine)%end;
83
+ %else %if &ext in (c cc cxx cpp h hh dic)
84
+ %then %do;%str(text/x-c)%end;
85
+ %else %if &ext in (mpga mp2 mp2a mp3 m2a m3a)
86
+ %then %do;%str(audio/mpeg)%end;
87
+ %else %if &ext in (t tr roff man me ms)
88
+ %then %do;%str(text/troff)%end;
89
+ %else %if &ext in (cbr cba cbt cbz cb7)
90
+ %then %do;%str(application/x-cbr)%end;
91
+ %else %if &ext in (fh fhc fh4 fh5 fh7)
92
+ %then %do;%str(image/x-freehand)%end;
93
+ %else %if &ext in (aab x32 u32 vox)
94
+ %then %do;%str(application/x-authorware-bin)%end;
95
+ %else %if &ext in (uvi uvvi uvg uvvg)
96
+ %then %do;%str(image/vnd.dece.graphic)%end;
97
+ %else %if &ext in (cdx cif cmdf cml csml xyz)
98
+ %then %do;%str(chemical/x-&ext)%end;
99
+ %else %if &ext in (aif aiff aifc) %then %do;%str(audio/x-aiff)%end;
100
+ %else %if &ext in (ma nb mb) %then %do;%str(application/mathematica)%end;
101
+ %else %if &ext in (mvb m13 m14) %then %do;%str(application/x-msmediaview)%end;
102
+ %else %if &ext in (msh mesh silo) %then %do;%str(model/mesh)%end;
103
+ %else %if &ext in (uri uris urls) %then %do;%str(text/uri-list)%end;
104
+ %else %if &ext in (mkv mk3d mks) %then %do;%str(video/x-matroska)%end;
105
+ %else %if &ext=ez %then %do;%str(application/andrew-inset)%end;
106
+ %else %if &ext=aw %then %do;%str(application/applixware)%end;
107
+ %else %if &ext=cdmia %then %do;%str(application/cdmi-capability)%end;
108
+ %else %if &ext=cdmic %then %do;%str(application/cdmi-container)%end;
109
+ %else %if &ext=cdmid %then %do;%str(application/cdmi-domain)%end;
110
+ %else %if &ext=cdmio %then %do;%str(application/cdmi-object)%end;
111
+ %else %if &ext=cdmiq %then %do;%str(application/cdmi-queue)%end;
112
+ %else %if &ext=cu %then %do;%str(application/cu-seeme)%end;
113
+ %else %if &ext=dssc %then %do;%str(application/dssc+der)%end;
114
+ %else %if &ext=xdssc %then %do;%str(application/dssc+xml)%end;
115
+ %else %if &ext=ecma %then %do;%str(application/ecmascript)%end;
116
+ %else %if &ext=epub %then %do;%str(application/epub+zip)%end;
117
+ %else %if &ext=pfr %then %do;%str(application/font-tdpfr)%end;
118
+ %else %if &ext=stk %then %do;%str(application/hyperstudio)%end;
119
+ %else %if &ext=ink %then %do;%str(application/inkml+xml)%end;
120
+ %else %if &ext=jar %then %do;%str(application/java-archive)%end;
121
+ %else %if &ext=ser %then %do;%str(application/java-serialized-object)%end;
122
+ %else %if &ext=class %then %do;%str(application/java-vm)%end;
123
+ %else %if &ext=jsonml %then %do;%str(application/jsonml+json)%end;
124
+ %else %if &ext=lostxml %then %do;%str(application/lost+xml)%end;
125
+ %else %if &ext=hqx %then %do;%str(application/mac-binhex40)%end;
126
+ %else %if &ext=cpt %then %do;%str(application/mac-compactpro)%end;
127
+ %else %if &ext=mrc %then %do;%str(application/marc)%end;
128
+ %else %if &ext=mrcx %then %do;%str(application/marcxml+xml)%end;
129
+ %else %if &ext=mscml %then %do;%str(application/mediaservercontrol+xml)%end;
130
+ %else %if &ext=meta4 %then %do;%str(application/metalink4+xml)%end;
131
+ %else %if &ext=m21 %then %do;%str(application/mp21)%end;
132
+ %else %if &ext=mp4s %then %do;%str(application/mp4)%end;
133
+ %else %if &ext=doc %then %do;%str(application/msword)%end;
134
+ %else %if &ext=dot %then %do;%str(application/msword)%end;
135
+ %else %if &ext=opf %then %do;%str(application/oebps-package+xml)%end;
136
+ %else %if &ext=ogx %then %do;%str(application/ogg)%end;
137
+ %else %if &ext=xer %then %do;%str(application/patch-ops-error+xml)%end;
138
+ %else %if &ext=pgp %then %do;%str(application/pgp-encrypted)%end;
139
+ %else %if &ext=asc %then %do;%str(application/pgp-signature)%end;
140
+ %else %if &ext=sig %then %do;%str(application/pgp-signature)%end;
141
+ %else %if &ext=prf %then %do;%str(application/pics-rules)%end;
142
+ %else %if &ext=p10 %then %do;%str(application/pkcs10)%end;
143
+ %else %if &ext=p7m %then %do;%str(application/pkcs7-mime)%end;
144
+ %else %if &ext=p7c %then %do;%str(application/pkcs7-mime)%end;
145
+ %else %if &ext=p7s %then %do;%str(application/pkcs7-signature)%end;
146
+ %else %if &ext=p8 %then %do;%str(application/pkcs8)%end;
147
+ %else %if &ext=ac %then %do;%str(application/pkix-attr-cert)%end;
148
+ %else %if &ext=cer %then %do;%str(application/pkix-cert)%end;
149
+ %else %if &ext=crl %then %do;%str(application/pkix-crl)%end;
150
+ %else %if &ext=pkipath %then %do;%str(application/pkix-pkipath)%end;
151
+ %else %if &ext=pki %then %do;%str(application/pkixcmp)%end;
152
+ %else %if &ext=cww %then %do;%str(application/prs.cww)%end;
153
+ %else %if &ext=pskcxml %then %do;%str(application/pskc+xml)%end;
154
+ %else %if &ext=rif %then %do;%str(application/reginfo+xml)%end;
155
+ %else %if &ext=rnc %then %do;%str(application/relax-ng-compact-syntax)%end;
156
+ %else %if &ext=rld %then %do;%str(application/resource-lists-diff+xml)%end;
157
+ %else %if &ext=rl %then %do;%str(application/resource-lists+xml)%end;
158
+ %else %if &ext=gbr %then %do;%str(application/rpki-ghostbusters)%end;
159
+ %else %if &ext=mft %then %do;%str(application/rpki-manifest)%end;
160
+ %else %if &ext=roa %then %do;%str(application/rpki-roa)%end;
161
+ %else %if &ext=scq %then %do;%str(application/scvp-cv-request)%end;
162
+ %else %if &ext=scs %then %do;%str(application/scvp-cv-response)%end;
163
+ %else %if &ext=spq %then %do;%str(application/scvp-vp-request)%end;
164
+ %else %if &ext=spp %then %do;%str(application/scvp-vp-response)%end;
165
+ %else %if &ext=setpay %then %do;%str(application/set-payment-initiation)%end;
166
+ %else %if &ext=setreg %then %do;%str(application/set-registration-initiation)%end;
167
+ %else %if &ext=smi %then %do;%str(application/smil+xml)%end;
168
+ %else %if &ext=rq %then %do;%str(application/sparql-query)%end;
169
+ %else %if &ext=srx %then %do;%str(application/sparql-results+xml)%end;
170
+ %else %if &ext=gram %then %do;%str(application/srgs)%end;
171
+ %else %if &ext=grxml %then %do;%str(application/srgs+xml)%end;
172
+ %else %if &ext=teicorpus %then %do;%str(application/tei+xml)%end;
173
+ %else %if &ext=tfi %then %do;%str(application/thraud+xml)%end;
174
+ %else %if &ext=tsd %then %do;%str(application/timestamped-data)%end;
175
+ %else %if &ext=vxml %then %do;%str(application/voicexml+xml)%end;
176
+ %else %if &ext=wgt %then %do;%str(application/widget)%end;
177
+ %else %if &ext=hlp %then %do;%str(application/winhlp)%end;
178
+ %else %if &ext=7z %then %do;%str(application/x-7z-compressed)%end;
179
+ %else %if &ext=abw %then %do;%str(application/x-abiword)%end;
180
+ %else %if &ext=ace %then %do;%str(application/x-ace-compressed)%end;
181
+ %else %if &ext=dmg %then %do;%str(application/x-apple-diskimage)%end;
182
+ %else %if &ext=aam %then %do;%str(application/x-authorware-map)%end;
183
+ %else %if &ext=aas %then %do;%str(application/x-authorware-seg)%end;
184
+ %else %if &ext=bcpio %then %do;%str(application/x-bcpio)%end;
185
+ %else %if &ext=torrent %then %do;%str(application/x-bittorrent)%end;
186
+ %else %if &ext=blb %then %do;%str(application/x-blorb)%end;
187
+ %else %if &ext=blorb %then %do;%str(application/x-blorb)%end;
188
+ %else %if &ext=bz %then %do;%str(application/x-bzip)%end;
189
+ %else %if &ext=bz2 %then %do;%str(application/x-bzip2)%end;
190
+ %else %if &ext=boz %then %do;%str(application/x-bzip2)%end;
191
+ %else %if &ext=vcd %then %do;%str(application/x-cdlink)%end;
192
+ %else %if &ext=cfs %then %do;%str(application/x-cfs-compressed)%end;
193
+ %else %if &ext=chat %then %do;%str(application/x-chat)%end;
194
+ %else %if &ext=pgn %then %do;%str(application/x-chess-pgn)%end;
195
+ %else %if &ext=nsc %then %do;%str(application/x-conference)%end;
196
+ %else %if &ext=cpio %then %do;%str(application/x-cpio)%end;
197
+ %else %if &ext=csh %then %do;%str(application/x-csh)%end;
198
+ %else %if &ext=deb %then %do;%str(application/x-debian-package)%end;
199
+ %else %if &ext=udeb %then %do;%str(application/x-debian-package)%end;
200
+ %else %if &ext=dgc %then %do;%str(application/x-dgc-compressed)%end;
201
+ %else %if &ext=wad %then %do;%str(application/x-doom)%end;
202
+ %else %if &ext=ncx %then %do;%str(application/x-dtbncx+xml)%end;
203
+ %else %if &ext=dtb %then %do;%str(application/x-dtbook+xml)%end;
204
+ %else %if &ext=res %then %do;%str(application/x-dtbresource+xml)%end;
205
+ %else %if &ext=dvi %then %do;%str(application/x-dvi)%end;
206
+ %else %if &ext=evy %then %do;%str(application/x-envoy)%end;
207
+ %else %if &ext=eva %then %do;%str(application/x-eva)%end;
208
+ %else %if &ext=bdf %then %do;%str(application/x-font-bdf)%end;
209
+ %else %if &ext=gsf %then %do;%str(application/x-font-ghostscript)%end;
210
+ %else %if &ext=psf %then %do;%str(application/x-font-linux-psf)%end;
211
+ %else %if &ext=pcf %then %do;%str(application/x-font-pcf)%end;
212
+ %else %if &ext=snf %then %do;%str(application/x-font-snf)%end;
213
+ %else %if &ext=arc %then %do;%str(application/x-freearc)%end;
214
+ %else %if &ext=spl %then %do;%str(application/x-futuresplash)%end;
215
+ %else %if &ext=gca %then %do;%str(application/x-gca-compressed)%end;
216
+ %else %if &ext=ulx %then %do;%str(application/x-glulx)%end;
217
+ %else %if &ext=gnumeric %then %do;%str(application/x-gnumeric)%end;
218
+ %else %if &ext=gramps %then %do;%str(application/x-gramps-xml)%end;
219
+ %else %if &ext=gtar %then %do;%str(application/x-gtar)%end;
220
+ %else %if &ext=hdf %then %do;%str(application/x-hdf)%end;
221
+ %else %if &ext=install %then %do;%str(application/x-install-instructions)%end;
222
+ %else %if &ext=iso %then %do;%str(application/x-iso9660-image)%end;
223
+ %else %if &ext=jnlp %then %do;%str(application/x-java-jnlp-file)%end;
224
+ %else %if &ext=latex %then %do;%str(application/x-latex)%end;
225
+ %else %if &ext=lzh %then %do;%str(application/x-lzh-compressed)%end;
226
+ %else %if &ext=lha %then %do;%str(application/x-lzh-compressed)%end;
227
+ %else %if &ext=mie %then %do;%str(application/x-mie)%end;
228
+ %else %if &ext=prc %then %do;%str(application/x-mobipocket-ebook)%end;
229
+ %else %if &ext=mobi %then %do;%str(application/x-mobipocket-ebook)%end;
230
+ %else %if &ext=application %then %do;%str(application/x-ms-application)%end;
231
+ %else %if &ext=lnk %then %do;%str(application/x-ms-shortcut)%end;
232
+ %else %if &ext=wmd %then %do;%str(application/x-ms-wmd)%end;
233
+ %else %if &ext=wmz %then %do;%str(application/x-ms-wmz)%end;
234
+ %else %if &ext=xbap %then %do;%str(application/x-ms-xbap)%end;
235
+ %else %if &ext=mdb %then %do;%str(application/x-msaccess)%end;
236
+ %else %if &ext=obd %then %do;%str(application/x-msbinder)%end;
237
+ %else %if &ext=crd %then %do;%str(application/x-mscardfile)%end;
238
+ %else %if &ext=clp %then %do;%str(application/x-msclip)%end;
239
+ %else %if &ext=mny %then %do;%str(application/x-msmoney)%end;
240
+ %else %if &ext=pub %then %do;%str(application/x-mspublisher)%end;
241
+ %else %if &ext=scd %then %do;%str(application/x-msschedule)%end;
242
+ %else %if &ext=trm %then %do;%str(application/x-msterminal)%end;
243
+ %else %if &ext=wri %then %do;%str(application/x-mswrite)%end;
244
+ %else %if &ext=nc %then %do;%str(application/x-netcdf)%end;
245
+ %else %if &ext=cdf %then %do;%str(application/x-netcdf)%end;
246
+ %else %if &ext=nzb %then %do;%str(application/x-nzb)%end;
247
+ %else %if &ext=p12 %then %do;%str(application/x-pkcs12)%end;
248
+ %else %if &ext=pfx %then %do;%str(application/x-pkcs12)%end;
249
+ %else %if &ext=p7b %then %do;%str(application/x-pkcs7-certificates)%end;
250
+ %else %if &ext=spc %then %do;%str(application/x-pkcs7-certificates)%end;
251
+ %else %if &ext=p7r %then %do;%str(application/x-pkcs7-certreqresp)%end;
252
+ %else %if &ext=rar %then %do;%str(application/x-rar-compressed)%end;
253
+ %else %if &ext=ris %then %do;%str(application/x-research-info-systems)%end;
254
+ %else %if &ext=sh %then %do;%str(application/x-sh)%end;
255
+ %else %if &ext=shar %then %do;%str(application/x-shar)%end;
256
+ %else %if &ext=swf %then %do;%str(application/x-shockwave-flash)%end;
257
+ %else %if &ext=xap %then %do;%str(application/x-silverlight-app)%end;
258
+ %else %if &ext=sql %then %do;%str(application/x-sql)%end;
259
+ %else %if &ext=sit %then %do;%str(application/x-stuffit)%end;
260
+ %else %if &ext=sitx %then %do;%str(application/x-stuffitx)%end;
261
+ %else %if &ext=srt %then %do;%str(application/x-subrip)%end;
262
+ %else %if &ext=sv4cpio %then %do;%str(application/x-sv4cpio)%end;
263
+ %else %if &ext=sv4crc %then %do;%str(application/x-sv4crc)%end;
264
+ %else %if &ext=t3 %then %do;%str(application/x-t3vm-image)%end;
265
+ %else %if &ext=gam %then %do;%str(application/x-tads)%end;
266
+ %else %if &ext=tar %then %do;%str(application/x-tar)%end;
267
+ %else %if &ext=tcl %then %do;%str(application/x-tcl)%end;
268
+ %else %if &ext=tex %then %do;%str(application/x-tex)%end;
269
+ %else %if &ext=tfm %then %do;%str(application/x-tex-tfm)%end;
270
+ %else %if &ext=texinfo %then %do;%str(application/x-texinfo)%end;
271
+ %else %if &ext=texi %then %do;%str(application/x-texinfo)%end;
272
+ %else %if &ext=obj %then %do;%str(application/x-tgif)%end;
273
+ %else %if &ext=ustar %then %do;%str(application/x-ustar)%end;
274
+ %else %if &ext=src %then %do;%str(application/x-wais-source)%end;
275
+ %else %if &ext=der %then %do;%str(application/x-x509-ca-cert)%end;
276
+ %else %if &ext=crt %then %do;%str(application/x-x509-ca-cert)%end;
277
+ %else %if &ext=fig %then %do;%str(application/x-xfig)%end;
278
+ %else %if &ext=xlf %then %do;%str(application/x-xliff+xml)%end;
279
+ %else %if &ext=xpi %then %do;%str(application/x-xpinstall)%end;
280
+ %else %if &ext=xz %then %do;%str(application/x-xz)%end;
281
+ %else %if &ext=xdf %then %do;%str(application/xcap-diff+xml)%end;
282
+ %else %if &ext=xht %then %do;%str(application/xhtml+xml)%end;
283
+ %else %if &ext=xsl %then %do;%str(application/xml)%end;
284
+ %else %if &ext=dtd %then %do;%str(application/xml-dtd)%end;
285
+ %else %if &ext=xpl %then %do;%str(application/xproc+xml)%end;
286
+ %else %if &ext=adp %then %do;%str(audio/adpcm)%end;
287
+ %else %if &ext=au %then %do;%str(audio/basic)%end;
288
+ %else %if &ext=snd %then %do;%str(audio/basic)%end;
289
+ %else %if &ext=m4a %then %do;%str(audio/mp4)%end;
290
+ %else %if &ext=mp4a %then %do;%str(audio/mp4)%end;
291
+ %else %if &ext=s3m %then %do;%str(audio/s3m)%end;
292
+ %else %if &ext=sil %then %do;%str(audio/silk)%end;
293
+ %else %if &ext=uva %then %do;%str(audio/vnd.dece.audio)%end;
294
+ %else %if &ext=uvva %then %do;%str(audio/vnd.dece.audio)%end;
295
+ %else %if &ext=eol %then %do;%str(audio/vnd.digital-winds)%end;
296
+ %else %if &ext=dra %then %do;%str(audio/vnd.dra)%end;
297
+ %else %if &ext=dts %then %do;%str(audio/vnd.dts)%end;
298
+ %else %if &ext=dtshd %then %do;%str(audio/vnd.dts.hd)%end;
299
+ %else %if &ext=lvp %then %do;%str(audio/vnd.lucent.voice)%end;
300
+ %else %if &ext=pya %then %do;%str(audio/vnd.ms-playready.media.pya)%end;
301
+ %else %if &ext=ecelp4800 %then %do;%str(audio/vnd.nuera.ecelp4800)%end;
302
+ %else %if &ext=ecelp7470 %then %do;%str(audio/vnd.nuera.ecelp7470)%end;
303
+ %else %if &ext=ecelp9600 %then %do;%str(audio/vnd.nuera.ecelp9600)%end;
304
+ %else %if &ext=rip %then %do;%str(audio/vnd.rip)%end;
305
+ %else %if &ext=weba %then %do;%str(audio/webm)%end;
306
+ %else %if &ext=mka %then %do;%str(audio/x-matroska)%end;
307
+ %else %if &ext=m3u %then %do;%str(audio/x-mpegurl)%end;
308
+ %else %if &ext=wax %then %do;%str(audio/x-ms-wax)%end;
309
+ %else %if &ext=wma %then %do;%str(audio/x-ms-wma)%end;
310
+ %else %if &ext=ra %then %do;%str(audio/x-pn-realaudio)%end;
311
+ %else %if &ext=ram %then %do;%str(audio/x-pn-realaudio)%end;
312
+ %else %if &ext=rmp %then %do;%str(audio/x-pn-realaudio-plugin)%end;
313
+ %else %if &ext=xm %then %do;%str(audio/xm)%end;
314
+ %else %if &ext=ttc %then %do;%str(font/collection)%end;
315
+ %else %if &ext=g3 %then %do;%str(image/g3fax)%end;
316
+ %else %if &ext=btif %then %do;%str(image/prs.btif)%end;
317
+ %else %if &ext=svg %then %do;%str(image/svg+xml)%end;
318
+ %else %if &ext=svgz %then %do;%str(image/svg+xml)%end;
319
+ %else %if &ext=tif %then %do;%str(image/tiff)%end;
320
+ %else %if &ext=psd %then %do;%str(image/vnd.adobe.photoshop)%end;
321
+ %else %if &ext=djv %then %do;%str(image/vnd.djvu)%end;
322
+ %else %if &ext=djvu %then %do;%str(image/vnd.djvu)%end;
323
+ %else %if &ext=sub %then %do;%str(image/vnd.dvb.subtitle)%end;
324
+ %else %if &ext=dwg %then %do;%str(image/vnd.dwg)%end;
325
+ %else %if &ext=dxf %then %do;%str(image/vnd.dxf)%end;
326
+ %else %if &ext=fbs %then %do;%str(image/vnd.fastbidsheet)%end;
327
+ %else %if &ext=fpx %then %do;%str(image/vnd.fpx)%end;
328
+ %else %if &ext=fst %then %do;%str(image/vnd.fst)%end;
329
+ %else %if &ext=mmr %then %do;%str(image/vnd.fujixerox.edmics-mmr)%end;
330
+ %else %if &ext=rlc %then %do;%str(image/vnd.fujixerox.edmics-rlc)%end;
331
+ %else %if &ext=mdi %then %do;%str(image/vnd.ms-modi)%end;
332
+ %else %if &ext=wdp %then %do;%str(image/vnd.ms-photo)%end;
333
+ %else %if &ext=npx %then %do;%str(image/vnd.net-fpx)%end;
334
+ %else %if &ext=wbmp %then %do;%str(image/vnd.wap.wbmp)%end;
335
+ %else %if &ext=xif %then %do;%str(image/vnd.xiff)%end;
336
+ %else %if &ext=ras %then %do;%str(image/x-cmu-raster)%end;
337
+ %else %if &ext=ico %then %do;%str(image/x-icon)%end;
338
+ %else %if &ext=sid %then %do;%str(image/x-mrsid-image)%end;
339
+ %else %if &ext=pct %then %do;%str(image/x-pict)%end;
340
+ %else %if &ext=pic %then %do;%str(image/x-pict)%end;
341
+ %else %if &ext=pnm %then %do;%str(image/x-portable-anymap)%end;
342
+ %else %if &ext=pbm %then %do;%str(image/x-portable-bitmap)%end;
343
+ %else %if &ext=pgm %then %do;%str(image/x-portable-graymap)%end;
344
+ %else %if &ext=ppm %then %do;%str(image/x-portable-pixmap)%end;
345
+ %else %if &ext=xbm %then %do;%str(image/x-xbitmap)%end;
346
+ %else %if &ext=xpm %then %do;%str(image/x-xpixmap)%end;
347
+ %else %if &ext=xwd %then %do;%str(image/x-xwindowdump)%end;
348
+ %else %if &ext=eml %then %do;%str(message/rfc822)%end;
349
+ %else %if &ext=mime %then %do;%str(message/rfc822)%end;
350
+ %else %if &ext=iges %then %do;%str(model/iges)%end;
351
+ %else %if &ext=igs %then %do;%str(model/iges)%end;
352
+ %else %if &ext=dae %then %do;%str(model/vnd.collada+xml)%end;
353
+ %else %if &ext=dwf %then %do;%str(model/vnd.dwf)%end;
354
+ %else %if &ext=gdl %then %do;%str(model/vnd.gdl)%end;
355
+ %else %if &ext=gtw %then %do;%str(model/vnd.gtw)%end;
356
+ %else %if &ext=vtu %then %do;%str(model/vnd.vtu)%end;
357
+ %else %if &ext=vrml %then %do;%str(model/vrml)%end;
358
+ %else %if &ext=wrl %then %do;%str(model/vrml)%end;
359
+ %else %if &ext=x3db %then %do;%str(model/x3d+binary)%end;
360
+ %else %if &ext=x3dbz %then %do;%str(model/x3d+binary)%end;
361
+ %else %if &ext=x3dv %then %do;%str(model/x3d+vrml)%end;
362
+ %else %if &ext=x3dvz %then %do;%str(model/x3d+vrml)%end;
363
+ %else %if &ext=x3d %then %do;%str(model/x3d+xml)%end;
364
+ %else %if &ext=x3dz %then %do;%str(model/x3d+xml)%end;
365
+ %else %if &ext=appcache %then %do;%str(text/cache-manifest)%end;
366
+ %else %if &ext=ics %then %do;%str(text/calendar)%end;
367
+ %else %if &ext=ifb %then %do;%str(text/calendar)%end;
368
+ %else %if &ext=htm %then %do;%str(text/html)%end;
369
+ %else %if &ext=js %then %do;%str(text/javascript)%end;
370
+ %else %if &ext=mjs %then %do;%str(text/javascript)%end;
371
+ %else %if &ext=dsc %then %do;%str(text/prs.lines.tag)%end;
372
+ %else %if &ext=rtx %then %do;%str(text/richtext)%end;
373
+ %else %if &ext=sgm %then %do;%str(text/sgml)%end;
374
+ %else %if &ext=tsv %then %do;%str(text/tab-separated-values)%end;
375
+ %else %if &ext=ttl %then %do;%str(text/turtle)%end;
376
+ %else %if &ext=curl %then %do;%str(text/vnd.curl)%end;
377
+ %else %if &ext=dcurl %then %do;%str(text/vnd.curl.dcurl)%end;
378
+ %else %if &ext=mcurl %then %do;%str(text/vnd.curl.mcurl)%end;
379
+ %else %if &ext=scurl %then %do;%str(text/vnd.curl.scurl)%end;
380
+ %else %if &ext=sub %then %do;%str(text/vnd.dvb.subtitle)%end;
381
+ %else %if &ext=fly %then %do;%str(text/vnd.fly)%end;
382
+ %else %if &ext=flx %then %do;%str(text/vnd.fmi.flexstor)%end;
383
+ %else %if &ext=gv %then %do;%str(text/vnd.graphviz)%end;
384
+ %else %if &ext=3dml %then %do;%str(text/vnd.in3d.3dml)%end;
385
+ %else %if &ext=spot %then %do;%str(text/vnd.in3d.spot)%end;
386
+ %else %if &ext=jad %then %do;%str(text/vnd.sun.j2me.app-descriptor)%end;
387
+ %else %if &ext=wml %then %do;%str(text/vnd.wap.wml)%end;
388
+ %else %if &ext=wmls %then %do;%str(text/vnd.wap.wmlscript)%end;
389
+ %else %if &ext=s %then %do;%str(text/x-asm)%end;
390
+ %else %if &ext=java %then %do;%str(text/x-java-source)%end;
391
+ %else %if &ext=p %then %do;%str(text/x-pascal)%end;
392
+ %else %if &ext=pas %then %do;%str(text/x-pascal)%end;
393
+ %else %if &ext=etx %then %do;%str(text/x-setext)%end;
394
+ %else %if &ext=uu %then %do;%str(text/x-uuencode)%end;
395
+ %else %if &ext=vcs %then %do;%str(text/x-vcalendar)%end;
396
+ %else %if &ext=vcf %then %do;%str(text/x-vcard)%end;
397
+ %else %if &ext=3gp %then %do;%str(video/3gpp)%end;
398
+ %else %if &ext=3g2 %then %do;%str(video/3gpp2)%end;
399
+ %else %if &ext=jpgv %then %do;%str(video/jpeg)%end;
400
+ %else %if &ext=jpgm %then %do;%str(video/jpm)%end;
401
+ %else %if &ext=mjp2 %then %do;%str(video/mj2)%end;
402
+ %else %if &ext=ogv %then %do;%str(video/ogg)%end;
403
+ %else %if &ext=mov %then %do;%str(video/quicktime)%end;
404
+ %else %if &ext=qt %then %do;%str(video/quicktime)%end;
405
+ %else %if &ext=uvh %then %do;%str(video/vnd.dece.hd)%end;
406
+ %else %if &ext=uvvh %then %do;%str(video/vnd.dece.hd)%end;
407
+ %else %if &ext=uvm %then %do;%str(video/vnd.dece.mobile)%end;
408
+ %else %if &ext=uvvm %then %do;%str(video/vnd.dece.mobile)%end;
409
+ %else %if &ext=uvp %then %do;%str(video/vnd.dece.pd)%end;
410
+ %else %if &ext=uvvp %then %do;%str(video/vnd.dece.pd)%end;
411
+ %else %if &ext=uvs %then %do;%str(video/vnd.dece.sd)%end;
412
+ %else %if &ext=uvvs %then %do;%str(video/vnd.dece.sd)%end;
413
+ %else %if &ext=uvv %then %do;%str(video/vnd.dece.video)%end;
414
+ %else %if &ext=uvvv %then %do;%str(video/vnd.dece.video)%end;
415
+ %else %if &ext=dvb %then %do;%str(video/vnd.dvb.file)%end;
416
+ %else %if &ext=fvt %then %do;%str(video/vnd.fvt)%end;
417
+ %else %if &ext=m4u %then %do;%str(video/vnd.mpegurl)%end;
418
+ %else %if &ext=mxu %then %do;%str(video/vnd.mpegurl)%end;
419
+ %else %if &ext=pyv %then %do;%str(video/vnd.ms-playready.media.pyv)%end;
420
+ %else %if &ext=uvu %then %do;%str(video/vnd.uvvu.mp4)%end;
421
+ %else %if &ext=uvvu %then %do;%str(video/vnd.uvvu.mp4)%end;
422
+ %else %if &ext=viv %then %do;%str(video/vnd.vivo)%end;
423
+ %else %if &ext=asf %then %do;%str(video/x-ms-asf)%end;
424
+ %else %if &ext=asx %then %do;%str(video/x-ms-asf)%end;
425
+ %else %if &ext=vob %then %do;%str(video/x-ms-vob)%end;
426
+ %else %if &ext=wm %then %do;%str(video/x-ms-wm)%end;
427
+ %else %if &ext=wmv %then %do;%str(video/x-ms-wmv)%end;
428
+ %else %if &ext=wmx %then %do;%str(video/x-ms-wmx)%end;
429
+ %else %if &ext=wvx %then %do;%str(video/x-ms-wvx)%end;
430
+ %else %if &ext=avi %then %do;%str(video/x-msvideo)%end;
431
+ %else %if &ext=movie %then %do;%str(video/x-sgi-movie)%end;
432
+ %else %if &ext=ice %then %do;%str(x-conference/x-cooltalk)%end;
433
+ %else %if "&ext"="in" %then %do;%str(text/plain)%end;
434
+ %else %do;%str(application/octet-stream)%end;
435
+
436
+ %mend mf_mimetype;
package/package.json CHANGED
@@ -32,5 +32,5 @@
32
32
  "lint": "npx @sasjs/cli lint",
33
33
  "prepare": "git rev-parse --git-dir && git config core.hooksPath ./.git-hooks || true"
34
34
  },
35
- "version": "4.56.1"
35
+ "version": "4.57.1"
36
36
  }
@@ -0,0 +1,52 @@
1
+ /**
2
+ @file
3
+ @brief Returns the uri of a file or folder
4
+ @details The automatic variable `_FILESRVC_[fref]_URI` is used after assigning
5
+ a fileref using the filesrvc engine.
6
+
7
+ Usage:
8
+
9
+ %put %mfv_getpathuri(/Public/folder/file.txt);
10
+ %put %mfv_getpathuri(/Public/folder);
11
+
12
+ @param [in] filepath The full path to the file on SAS drive
13
+ (eg /Public/myfile.txt)
14
+
15
+ <h4> SAS Macros </h4>
16
+ @li mf_abort.sas
17
+ @li mf_getuniquefileref.sas
18
+
19
+ <h4> Related Macros </h4>
20
+ @li mfv_existfile.sas
21
+ @li mfv_existfolder.sas
22
+
23
+ @version 3.5
24
+ @author [Allan Bowe](https://www.linkedin.com/in/allanbowe/)
25
+ **/
26
+
27
+ %macro mfv_getpathuri(filepath
28
+ )/*/STORE SOURCE*/;
29
+
30
+ %mf_abort(
31
+ iftrue=(&syscc ne 0),
32
+ msg=Cannot enter &sysmacroname with syscc=&syscc
33
+ )
34
+
35
+ %local fref rc path name var /* var is used to avoid delete timing issue */;
36
+ %let fref=%mf_getuniquefileref();
37
+ %let name=%scan(&filepath,-1,/);
38
+ %let path=%substr(&filepath,1,%length(&filepath)-%length(&name)-1);
39
+
40
+ %if %sysfunc(filename(fref,,filesrvc,folderPath="&path" filename="&name"))=0
41
+ %then %do;
42
+ %let var=_FILESRVC_&fref._URI;
43
+ %str(&&&var)
44
+ %let rc=%sysfunc(filename(fref));
45
+ %symdel &var;
46
+ %end;
47
+ %else %do;
48
+ %put &sysmacroname: did not find &filepath;
49
+ %let syscc=0;
50
+ %end;
51
+
52
+ %mend mfv_getpathuri;
@@ -1,8 +1,12 @@
1
1
  /**
2
2
  @file
3
- @brief Creates a file in SAS Drive
4
- @details Creates a file in SAS Drive and adds the appropriate content type.
3
+ @brief Creates a file in SAS Drive using the API method
4
+ @details Creates a file in SAS Drive using the API interface.
5
5
  If the parent folder does not exist, it is created.
6
+ The API approach is more flexible than using the filesrvc engine of the
7
+ filename statement, as it provides more options.
8
+
9
+ SAS docs: https://developer.sas.com/rest-apis/files/createNewFile
6
10
 
7
11
  Usage:
8
12
 
@@ -14,49 +18,57 @@
14
18
  %mv_createfile(path=/Public/temp,name=newfile.txt,inref=myfile)
15
19
 
16
20
 
17
- @param [in] path= The parent folder in which to create the file
21
+ @param [in] path= The parent (SAS Drive) folder in which to create the file
18
22
  @param [in] name= The name of the file to be created
19
23
  @param [in] inref= The fileref pointing to the file to be uploaded
20
24
  @param [in] intype= (BINARY) The type of the input data. Valid values:
21
25
  @li BINARY File is copied byte for byte using the mp_binarycopy.sas macro.
22
26
  @li BASE64 File will be first decoded using the mp_base64.sas macro, then
23
27
  loaded byte by byte to SAS Drive.
24
- @param [in] contentdisp= (inline) Content Disposition. Example values:
28
+ @param [in] contentdisp= (attchment) Content Disposition. Example values:
25
29
  @li inline
26
30
  @li attachment
27
- @param [in] ctype= (0) Set a default HTTP Content-Type header to be returned
28
- with the file when the content is retrieved from the Files service.
31
+ @param [in] ctype= (0) The actual MIME type of the file (if blank will be
32
+ determined based on file extension))
29
33
  @param [in] access_token_var= The global macro variable to contain the access
30
34
  token, if using authorization_code grant type.
31
35
  @param [in] grant_type= (sas_services) Valid values are:
32
36
  @li password
33
37
  @li authorization_code
34
38
  @li sas_services
39
+ @param [in] force= (YES) Will overwrite (delete / recreate) files by default.
40
+ Set to NO to abort if a file already exists in that location.
41
+ @param [out] outds= (_null_) Output dataset with the uri of the new file
35
42
 
36
43
  @param [in] mdebug= (0) Set to 1 to enable DEBUG messages
37
44
 
38
- @version VIYA V.03.05
39
- @author Allan Bowe, source: https://github.com/sasjs/core
40
-
41
45
  <h4> SAS Macros </h4>
46
+ @li mf_getplatform.sas
42
47
  @li mf_getuniquefileref.sas
48
+ @li mf_getuniquename.sas
43
49
  @li mf_isblank.sas
50
+ @li mf_mimetype.sas
51
+ @li mfv_getpathuri.sas
44
52
  @li mp_abort.sas
45
53
  @li mp_base64copy.sas
46
- @li mp_binarycopy.sas
47
54
  @li mv_createfolder.sas
48
55
 
56
+ <h4> Related Macros</h4>
57
+ @li mv_createfile.sas
58
+
49
59
  **/
50
60
 
51
61
  %macro mv_createfile(path=
52
62
  ,name=
53
63
  ,inref=
54
64
  ,intype=BINARY
55
- ,contentdisp=inline
65
+ ,contentdisp=attachment
56
66
  ,ctype=0
57
67
  ,access_token_var=ACCESS_TOKEN
58
68
  ,grant_type=sas_services
59
69
  ,mdebug=0
70
+ ,outds=_null_
71
+ ,force=YES
60
72
  );
61
73
  %local dbg;
62
74
  %if &mdebug=1 %then %do;
@@ -78,51 +90,125 @@
78
90
  %mp_abort(iftrue=(&grant_type ne authorization_code and &grant_type ne password
79
91
  and &grant_type ne sas_services
80
92
  )
81
- ,mac=&sysmacroname
93
+ ,mac=MV_CREATEFILE
82
94
  ,msg=%str(Invalid value for grant_type: &grant_type)
83
95
  )
84
96
 
85
97
  %mp_abort(iftrue=(%mf_isblank(&path)=1 or %length(&path)=1)
86
- ,mac=&sysmacroname
98
+ ,mac=MV_CREATEFILE
87
99
  ,msg=%str(path value must be provided)
88
100
  )
89
101
  %mp_abort(iftrue=(%mf_isblank(&name)=1 or %length(&name)=1)
90
- ,mac=&sysmacroname
102
+ ,mac=MV_CREATEFILE
91
103
  ,msg=%str(name value with length >1 must be provided)
92
104
  )
93
105
 
94
- /* create folder if it does not already exist */
95
- %mv_createfolder(path=&path
96
- ,access_token_var=&access_token_var
97
- ,grant_type=&grant_type
98
- ,mdebug=&mdebug
99
- )
100
-
101
- /* create file with relevant options */
106
+ /* prep the source file */
102
107
  %local fref;
103
108
  %let fref=%mf_getuniquefileref();
104
- filename &fref filesrvc
105
- folderPath="&path"
106
- filename="&name"
107
- cdisp="&contentdisp"
108
- %if "&ctype" ne "0" %then %do;
109
- ctype="&ctype"
110
- %end;
111
- lrecl=1048544;
112
- %if &intype=BINARY %then %do;
113
- %mp_binarycopy(inref=&inref, outref=&fref)
114
- %end;
115
- %else %if &intype=BASE64 %then %do;
109
+
110
+ %if %upcase(&intype)=BINARY %then %let fref=&inref;
111
+ %else %if %upcase(&intype)=BASE64 %then %do;
116
112
  %mp_base64copy(inref=&inref, outref=&fref, action=DECODE)
117
113
  %end;
114
+ %else %put %str(ERR)OR: invalid value for intype: &intype;
118
115
 
119
- filename &fref clear;
120
116
 
117
+ %if &mdebug=1 %then %do;
118
+ data _null_;
119
+ infile &fref lrecl=32767;
120
+ input;
121
+ put _infile_;
122
+ run;
123
+ %end;
124
+
125
+ options noquotelenmax;
121
126
  %local base_uri; /* location of rest apis */
122
127
  %let base_uri=%mf_getplatform(VIYARESTAPI);
123
128
 
124
- %put &sysmacroname: File &name successfully created in &path;
125
- %put &sysmacroname:;%put;
129
+ /* create folder if it does not already exist */
130
+ %local folderds self_uri;
131
+ %let folderds=%mf_getuniquename(prefix=folderds);
132
+ %mv_createfolder(path=&path
133
+ ,access_token_var=&access_token_var
134
+ ,grant_type=&grant_type
135
+ ,mdebug=&mdebug
136
+ ,outds=&folderds
137
+ )
138
+ data _null_;
139
+ set &folderds;
140
+ call symputx('self_uri',self_uri,'l');
141
+ run;
142
+
143
+ /* abort or delete if file already exists */
144
+ %let force=%upcase(&force);
145
+ %local fileuri ;
146
+ %let fileuri=%mfv_getpathuri(&path/&name);
147
+ %mp_abort(iftrue=(%mf_isblank(&fileuri)=0 and &force ne YES)
148
+ ,mac=MV_CREATEFILE
149
+ ,msg=%str(File &path/&name already exists and force=&force)
150
+ )
151
+
152
+ %if %mf_isblank(&fileuri)=0 and &force=YES %then %do;
153
+ proc http method="DELETE" url="&base_uri&fileuri" &oauth_bearer;
154
+ headers
155
+ %if &grant_type=authorization_code %then %do;
156
+ "Authorization"="Bearer &&&access_token_var"
157
+ %end;
158
+ "Accept"="*/*";
159
+ run;
160
+ %put &sysmacroname DELETE &base_uri&fileuri
161
+ &=SYS_PROCHTTP_STATUS_CODE &=SYS_PROCHTTP_STATUS_PHRASE;
162
+ %end;
163
+
164
+ %local url mimetype;
165
+ %let url=&base_uri/files/files?parentFolderUri=&self_uri;
166
+
167
+ /* fetch job info */
168
+ %local fname1;
169
+ %let fname1=%mf_getuniquefileref();
170
+ proc http method='POST' out=&fname1 &oauth_bearer in=&fref
171
+ %if "&ctype" = "0" %then %do;
172
+ %let mimetype=%mf_mimetype(%scan(&name,-1,.));
173
+ ct="&mimetype"
174
+ %end;
175
+ %else %do;
176
+ ct="&ctype"
177
+ %end;
178
+ %if "&mimetype"="text/html" or "&mimetype"="text/css"
179
+ or "&mimetype"="text/javascript" %then %do;
180
+ url="&url%str(&)typeDefName=file";
181
+ %end;
182
+ %else %do;
183
+ url="&url";
184
+ %end;
185
+
186
+ headers "Accept"="application/json"
187
+ %if &grant_type=authorization_code %then %do;
188
+ "Authorization"="Bearer &&&access_token_var"
189
+ %end;
190
+ "Content-Disposition"= "&contentdisp filename=""&name""; name=""&name"";";
191
+ run;
192
+ %put &sysmacroname POST &=url
193
+ &=SYS_PROCHTTP_STATUS_CODE &=SYS_PROCHTTP_STATUS_PHRASE;
194
+ %mp_abort(iftrue=(&SYS_PROCHTTP_STATUS_CODE ne 201)
195
+ ,mac=MV_CREATEFILE
196
+ ,msg=%str(&SYS_PROCHTTP_STATUS_CODE &SYS_PROCHTTP_STATUS_PHRASE)
197
+ )
198
+ %local libref2;
199
+ %let libref2=%mf_getuniquelibref();
200
+ libname &libref2 JSON fileref=&fname1;
201
+ %put Grabbing the follow on link ;
202
+ data &outds;
203
+ set &libref2..links end=last;
204
+ if rel='createChild' then do;
205
+ call symputx('href',quote(cats("&base_uri",href)),'l');
206
+ &dbg put (_all_)(=);
207
+ end;
208
+ run;
209
+
210
+ %put &sysmacroname: File &name successfully created:;%put;
211
+ %put &base_uri%mfv_getpathuri(&path/&name);%put;
126
212
  %put &base_uri/SASJobExecution?_file=&path/&name;%put;
127
213
  %put &sysmacroname:;
128
214
 
@@ -17,15 +17,16 @@
17
17
  @li sas_services
18
18
 
19
19
  @param [in] mdebug=(0) set to 1 to enable DEBUG messages
20
+ @param [out] outds=(_null_) Optionally create an output dataset which will
21
+ contain the uri (self_uri) of the created (and parent) folder.
20
22
 
21
- @version VIYA V.03.04
22
- @author Allan Bowe, source: https://github.com/sasjs/core
23
23
 
24
24
  <h4> SAS Macros </h4>
25
25
  @li mp_abort.sas
26
26
  @li mf_getuniquefileref.sas
27
27
  @li mf_getuniquelibref.sas
28
28
  @li mf_isblank.sas
29
+ @li mfv_getpathuri.sas
29
30
  @li mf_getplatform.sas
30
31
  @li mfv_existfolder.sas
31
32
 
@@ -36,6 +37,7 @@
36
37
  ,access_token_var=ACCESS_TOKEN
37
38
  ,grant_type=sas_services
38
39
  ,mdebug=0
40
+ ,outds=_null_
39
41
  );
40
42
  %local dbg;
41
43
  %if &mdebug=1 %then %do;
@@ -46,6 +48,11 @@
46
48
 
47
49
  %if %mfv_existfolder(&path)=1 %then %do;
48
50
  %put &sysmacroname: &path already exists;
51
+ data &outds;
52
+ self_uri="%mfv_getpathuri(&path)";
53
+ output;
54
+ stop;
55
+ run;
49
56
  %return;
50
57
  %end;
51
58
 
@@ -80,12 +87,12 @@ options noquotelenmax;
80
87
  %local subfolder_cnt; /* determine the number of subfolders */
81
88
  %let subfolder_cnt=%sysfunc(countw(&path,/));
82
89
 
83
- %local href; /* resource address (none for root) */
84
- %let href="/folders/folders?parentFolderUri=/folders/folders/none";
85
-
86
90
  %local base_uri; /* location of rest apis */
87
91
  %let base_uri=%mf_getplatform(VIYARESTAPI);
88
92
 
93
+ %local href; /* resource address (none for root) */
94
+ %let href="&base_uri/folders/folders?parentFolderUri=/folders/folders/none";
95
+
89
96
  %local x newpath subfolder;
90
97
  %do x=1 %to &subfolder_cnt;
91
98
  %let subfolder=%scan(&path,&x,%str(/));
@@ -115,7 +122,7 @@ options noquotelenmax;
115
122
  %put &sysmacroname following check to see if &newpath exists:;
116
123
  %put _local_;
117
124
  data _null_;
118
- set &fname1;
125
+ infile &fname1;
119
126
  input;
120
127
  putlog _infile_;
121
128
  run;
@@ -167,12 +174,17 @@ options noquotelenmax;
167
174
  %let libref2=%mf_getuniquelibref();
168
175
  libname &libref2 JSON fileref=&fname2;
169
176
  %put &sysmacroname &newpath now created. Grabbing the follow on link ;
170
- data _null_;
177
+ data &outds;
171
178
  set &libref2..links;
172
179
  if rel='createChild' then do;
173
180
  call symputx('href',quote(cats("&base_uri",href)),'l');
174
181
  &dbg put (_all_)(=);
175
182
  end;
183
+ if method='GET' and rel='self' then do;
184
+ self_uri=uri;
185
+ output;
186
+ end;
187
+ keep self_uri ;
176
188
  run;
177
189
 
178
190
  libname &libref2 clear;
@@ -1,6 +1,6 @@
1
1
  /**
2
- @file mv_deleteviyafolder.sas
3
- @brief Creates a viya folder if that folder does not already exist
2
+ @file
3
+ @brief Deletes a viya folder
4
4
  @details If not running in Studo 5 +, will expect an oauth token in a global
5
5
  macro variable (default ACCESS_TOKEN).
6
6