- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi, i am trying to create an sample banking payment suggestion decision engine but i get an error ERROR: No DATALINES or INFILE statement when i run second part of my code where i need to prompt the user to enter recipient details(i.e cellphone number/card number/account number) as well as the amount they wish to send. see below code.
Your assistane would be greatly appreciated
data payment_options; input method $ cost maximum_amount; datalines; RPP 7 3000 Instant_Payment 7 3000 EFT_On_Us_PAYU 1 1000000 EFT_Off_Us_PAYU 1 1000000 EFT_Pay_to_Cell_PAYU 1 1000000 EFT_On_Us_Bundled 0 1000000 EFT_Off_Us_Bundled 0 1000000 EFT_Pay_to_Cell_Bundled 0 1000000 eWallet 2 3000 RTC 45 450000 ; run; /* Prompt the user for recipient information and amount */ data _null_; put 'Enter recipient information (cellphone, card, account): '; input recipient_info $; put 'Enter amount to send: '; input amount; run; /* Use an IF-ELSE statement to suggest the best payment method */ data suggest_payment; set payment_options; if recipient_info = 'cellphone' and amount <= 3000 then output; else if recipient_info = 'card' and amount <= 1000000 then output; else if recipient_info = 'account' and amount <= 1000000 then output; else put 'Invalid recipient information or amount'; run; proc print data=suggest_payment; run;
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
This
/* Prompt the user for recipient information and amount */
data _null_;
put 'Enter recipient information (cellphone, card, account): ';
input recipient_info $;
put 'Enter amount to send: ';
input amount;
run;
cannot work. PUT writes to the log or an external file (if assigned with FILE), and INPUT reads from files (INFILE) or DATALINES.
User prompts can be defined in Enterprise Guide and used in EG projects or stored processes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Have a look at the second data step, the input statement needs either infile or datalines statement to process data.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
This
/* Prompt the user for recipient information and amount */
data _null_;
put 'Enter recipient information (cellphone, card, account): ';
input recipient_info $;
put 'Enter amount to send: ';
input amount;
run;
cannot work. PUT writes to the log or an external file (if assigned with FILE), and INPUT reads from files (INFILE) or DATALINES.
User prompts can be defined in Enterprise Guide and used in EG projects or stored processes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Depending on the SAS environment the method for "prompting for user" changes.
If you are using a Display Manager environment you want to research the WINDOW and %WINDOW statements, which allows showing a prompt and reading data from a response. Otherwise describe the environment you are working in.
If you aren't going to save the responses in a data set then perhaps the %Window is appropriate to create macro variable values that could be used in your third data step directly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
For SAS EG there are "prompts", SAS even did a video about it:
https://video.sas.com/detail/video/6295499870001/create-and-use-prompts-in-queries-and-tasks
Bart
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug
"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings
SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation