- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
I've run into an issue with using an output statement within DS2 code in SAS MAS module. I had been using ds2 codes in a procedural window for my projects in SAS ESP 5.1. However in ESP 5.2, the DS2 codes need to be converted into functions in SAS MAS modules (in calculate windows) in order to be used. It seems like the output statement doesn't work after the conversion. I make use of the following code:
ds2_options sas;
package p1/overwrite=yes;
method test(bigint esp_id, in_out char test);
do i=1 to 3;
test='a';
output;
test='b';
output;
test='c';
output;
end;
end;
endpackage;
A simple example. I would like to output 3 rows for every esp_id that comes in within my calculate window:
esp_id=0 test='a'
esp_id=0 test='b'
esp_id=0 test='c'
esp_id=1 test='a'
esp_id=1 test='b'
esp_id=1 test='c'
but the window only outputs the last one (test='c') for each esp_id. I would really appreciate if someone knows how to solve this.
Mike
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
No idea if this will do, but if the problem is that the last output statement overwrites the others, you could try a loop with a single output statement:
method test(bigint esp_id, in_out char test);
do test='a','b','c';
output;
end;
end;
I do not understand why you have the do loop with the variable i in your original code, though.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi s_lassen, thank you for responding. Yes indeed, it seems like last output statement overwrites the others. Using your code, the Module 'test' failed to compile in user context. It seems like 'do' followed by character value causes the error. I have modified the code to:
method test(bigint esp_id, in_out bigint test);
do test=1,2,3;
output;
end;
end;
do followed by a numeric value works, but it only outputs test=3:
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi guys,
a small update. After looking into the documentation of SAS® MicroAnalyticService 5.2: Programming and Administration Guide:
https://documentation.sas.com/api/docsets/masag/5.2/content/masag.pdf?locale=en
In chapter 5 (DS2 Programming for SAS Micro Analytic Service), it is mentioned that output statements are not supported. Does anyone know an alternative for the output statement in this case?