Question

my problem is probably simple to some of you, for me it is a great obstacle :D.

I need to have an interaction window with user in which he will be able to write the date, which he wants to see data of (records for the purpose of regression).

%let dateP;
%window wprowadz
"insert date (ddmmyyyy):" dateP required = yes;
%display wprowadz;

and after that

data lab4.firmy2;
set lab4.firmy;
if first.nazwa then
    data=symget("dataP");
    zamkniecie=.;
keep nazwa data zamkniecie;
by nazwa;

This of course puts the needed expression into a macro variable. Trying to put it into dataset has brought results only when inserting date in the window in days (e.g. 17168). This however won't suffice.

What I need is to be able to insert the date in format yyyy-mm-dd or dd-mm-yyyy and then perhaps convert it do days so I can work with it neatly. I have tried many times with no results.

Any help will be appreciated :)

Was it helpful?

Solution

Something like this should work. Input it from a text string using your preferred informat.

data lab4.firmy2;
set lab4.firmy;
if first.nazwa then do;
    data=input("&datap.",YYMMDD.);
    zamkniecie=.;
end;
keep nazwa data zamkniecie;
by nazwa;

How are you interacting with the user (Base SAS or EG)? If you're in EG I think the prompt manager can shortcut some of this for you.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top