@sasjs/core 3.3.0 → 3.4.0

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.
@@ -7,8 +7,12 @@
7
7
 
8
8
  %put %mf_existvar(work.someds, somevar)
9
9
 
10
- @param libds (positional) - 2 part dataset or view reference
11
- @param var (positional) - variable name
10
+ @param [in] libds 2 part dataset or view reference
11
+ @param [in] var variable name
12
+
13
+ <h4> Related Macros </h4>
14
+ @li mf_existvar.test.sas
15
+
12
16
  @version 9.2
13
17
  @author Allan Bowe
14
18
  **/
@@ -0,0 +1,67 @@
1
+ /**
2
+ @file
3
+ @brief Creates a text file using pure macro
4
+ @details Creates a text file of up to 10 lines. If further lines are
5
+ desired, feel free to [create an issue](
6
+ https://github.com/sasjs/core/issues/new), or make a pull request!
7
+
8
+ The use of PARMBUFF was considered for this macro, but it would have made
9
+ things problematic for writing lines containing commas.
10
+
11
+ Usage:
12
+
13
+ %mf_writefile(&sasjswork/myfile.txt,l1=some content,l2=more content)
14
+ data _null_;
15
+ infile "&sasjswork/myfile.txt";
16
+ input;
17
+ list;
18
+ run;
19
+
20
+ @param [in] fpath Full path to file to be created or appended to
21
+ @param [in] mode= (O) Available options are A or O as follows:
22
+ @li A APPEND mode, writes new records after the current end of the file.
23
+ @li O OUTPUT mode, writes new records from the beginning of the file.
24
+ @param [in] l1= First line
25
+ @param [in] l2= Second line (etc through to l10)
26
+
27
+ <h4> Related Macros </h4>
28
+ @li mf_writefile.test.sas
29
+
30
+ @version 9.2
31
+ @author Allan Bowe
32
+ **/
33
+ /** @cond */
34
+
35
+ %macro mf_writefile(fpath,mode=O,l1=,l2=,l3=,l4=,l5=,l6=,l7=,l8=,l9=,l10=
36
+ )/*/STORE SOURCE*/;
37
+ %local fref rc fid i total_lines;
38
+
39
+ /* find number of lines by reference to first non-blank param */
40
+ %do i=10 %to 1 %by -1;
41
+ %if %str(&&l&i) ne %str() %then %goto continue;
42
+ %end;
43
+ %continue:
44
+ %let total_lines=&i;
45
+
46
+ %if %sysfunc(filename(fref,&fpath)) ne 0 %then %do;
47
+ %put &=fref &=fpath;
48
+ %put %str(ERR)OR: %sysfunc(sysmsg());
49
+ %return;
50
+ %end;
51
+
52
+ %let fid=%sysfunc(fopen(&fref,&mode));
53
+
54
+ %if &fid=0 %then %do;
55
+ %put %str(ERR)OR: %sysfunc(sysmsg());
56
+ %return;
57
+ %end;
58
+
59
+ %do i=1 %to &total_lines;
60
+ %let rc=%sysfunc(fput(&fid, &&l&i));
61
+ %let rc=%sysfunc(fwrite(&fid));
62
+ %end;
63
+ %let rc=%sysfunc(fclose(&fid));
64
+ %let rc=%sysfunc(filename(&fref));
65
+
66
+ %mend mf_writefile;
67
+ /** @endcond */
@@ -92,6 +92,7 @@ data &ds2;
92
92
  %end;
93
93
  output;
94
94
  end;
95
+ stop;
95
96
  run;
96
97
  proc sort data=&ds2 nodupkey;
97
98
  by &pk_fields;
package/package.json CHANGED
@@ -38,5 +38,5 @@
38
38
  "dependencies": {
39
39
  "ts-loader": "^9.2.6"
40
40
  },
41
- "version": "3.3.0"
41
+ "version": "3.4.0"
42
42
  }