Macros for SAS Application Developers
https://github.com/sasjs/core
Loading...
Searching...
No Matches
mp_cleancsv.test.sas
Go to the documentation of this file.
1/**
2 @file
3 @brief Testing mp_cleancsv.sas macro
4 @details Credit for test 1 goes to
5 [Tom](https://communities.sas.com/t5/user/viewprofilepage/user-id/159) from
6 SAS Communities:
7https://communities.sas.com/t5/SAS-Programming/Removing-embedded-carriage-returns/m-p/824790#M325761
8
9 <h4> SAS Macros </h4>
10 @li mf_nobs.sas
11 @li mp_cleancsv.sas
12 @li mp_assert.sas
13 @li mp_assertscope.sas
14
15**/
16
17/* test 1 - cope with empty rows on CR formatted file */
18
19filename crlf "%sysfunc(pathname(work))/crlf";
20filename cr "%sysfunc(pathname(work))/cr";
21data _null_;
22 file cr termstr=cr ;
23 put 'line 1'///'line 4'/'line 5';
24run;
25
26%mp_assertscope(SNAPSHOT)
27%mp_cleancsv(in=cr,out=crlf)
28%mp_assertscope(COMPARE)
29
30/* 5 rows as all converted to OD0A */
31data test1;
32 infile "%sysfunc(pathname(work))/crlf" lrecl=100 termstr=crlf;
33 input;
34 list;
35run;
36
37%put test1=%mf_nobs(test1);
38
39%mp_assert(
40 iftrue=(%mf_nobs(work.test1)=5),
41 desc=Checking blank rows on CR formatted file,
42 outds=work.test_results
43)