Type : CREATION_INTERNE
Los datos se generan y manipulan completamente de forma interna. La macro `%mf_writefile` crea un archivo de texto temporal (`&sasjswork/myfile.txt`) que sirve como origen y destino para las operaciones de lectura y escritura. No se utiliza ningún dato externo al script o de bibliotecas SAS estándar como SASHELP para la lógica de negocio o las pruebas.
| 1 | %mf_writefile(&sasjswork/myfile.txt,l1=some content,l2=more content) |
| 1 | DATA _null_; |
| 2 | INFILE "&sasjswork/myfile.txt"; |
| 3 | INPUT; |
| 4 | IF _n_=2 THEN call symputx('test1',_infile_); |
| 5 | RUN; |
| 1 | %mp_assert( |
| 2 | iftrue=(&syscc=0), |
| 3 | desc=Check code ran without errors, |
| 4 | outds=work.test_results |
| 5 | ) |
| 6 | %mp_assert( |
| 7 | iftrue=(&test1=more content), |
| 8 | desc=Checking line was created, |
| 9 | outds=work.test_results |
| 10 | ) |
| 1 | %mf_writefile(&sasjswork/myfile.txt,l1=some content,l2=different content) |
| 1 | DATA _null_; |
| 2 | INFILE "&sasjswork/myfile.txt"; |
| 3 | INPUT; |
| 4 | IF _n_=2 THEN call symputx('test2',_infile_); |
| 5 | RUN; |
| 1 | %mp_assert( |
| 2 | iftrue=(&syscc=0), |
| 3 | desc=Check code ran without errors for test2, |
| 4 | outds=work.test_results |
| 5 | ) |
| 6 | %mp_assert( |
| 7 | iftrue=(&test2=different content), |
| 8 | desc=Checking second line was overwritten, |
| 9 | outds=work.test_results |
| 10 | ) |
| 1 | %global test3 test4; |
| 2 | %mf_writefile(&sasjswork/myfile.txt |
| 3 | ,mode=a |
| 4 | ,l1=%str(aah, content) |
| 5 | ,l2=append content |
| 6 | ) |
| 1 | DATA _null_; |
| 2 | INFILE "&sasjswork/myfile.txt"; |
| 3 | INPUT; |
| 4 | IF _n_=2 THEN call symputx('test3',_infile_); |
| 5 | IF _n_=4 THEN call symputx('test4',_infile_); |
| 6 | RUN; |
| 1 | %mp_assert( |
| 2 | iftrue=(&syscc=0), |
| 3 | desc=Check code ran without errors for test2, |
| 4 | outds=work.test_results |
| 5 | ) |
| 6 | %mp_assert( |
| 7 | iftrue=(&test3=different content), |
| 8 | desc=Checking second line was not overwritten, |
| 9 | outds=work.test_results |
| 10 | ) |
| 11 | %mp_assert( |
| 12 | iftrue=(&test4=append content), |
| 13 | desc=Checking fourth line was appended, |
| 14 | outds=work.test_results |
| 15 | ) |