BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
dylanviking
Calcite | Level 5

I am trying to create a Task Prompt to allow a user to select a SAS program. I would then like to run the SAS program. Theoretically I should be able to achieve this by adding the program into an %include statement. 

 

I've managed to create the prompt to allow the user to select the SAS program

<Option defaultExtension="sas" defaultName="program" inputType="sasserverpath" pathtype="file" required="true" name="var_sasprog"/>

 

My assumption was then that the var_sasprog will contain the path value. However, it returned an object. I needed to find out how to use this newly populated object. Searching the net, I found this link:

https://github.com/sassoftware/sas-studio-tasks/blob/master/prompts/prompts/File_Selector.ctm

 

It seems that the value of the full path is contained within the fullPath value in a Velocity variable

https://documentation.sas.com/doc/en/webeditorcdc/v_032/webeditordg/n1648jbi8lc1j7n0zxi4b3e9rcbb.htm...

 

As  stated above, there are examples for Custom Tasks to extract the value from the Velocity variable via Code Templates, but how do I get the full path value captured in my Task Prompt to be used in my Job Execution?

1 ACCEPTED SOLUTION

Accepted Solutions
XavierBizoux
SAS Super FREQ

Hi, 

 

I've to admit that I've never used the file selector. Based on my experience, not all the options available in the CTM are implemented in SAS Job Execution. This should be one of the options which is not handled. While the prompt will display properly, the value may not be passed to the job. The easiest to workaround this limitation, would be to use a dataset as source for the prompt. The dataset should be created upfront and contain all the SAS code a user can select to execute. 

Depending on your needs, you may want to convert your prompt to HTML and use the SAS Content SDK to navigate inside the content server. Using SAS Content SDK, you can display only the job type. 

Let me know if you have questions. 

 

 

Xavier BIZOUX
Advisory Technical Architect ● Global Enablement and Learning
Technology Transfer and Governance, R&D

View solution in original post

7 REPLIES 7
sbxkoenk
SAS Super FREQ

Hello @dylanviking ,

 

Does this help? :

Koen

 
dylanviking
Calcite | Level 5

Hi Koen, 

 

Unfortunately no. This is related to SAS Viya 4 Task Prompts in SAS Job Execution. This is similar to SAS Stored Processes in 9.4 where you provide an interface to the user so they can provide inputs in a user-friendly kind of way. However, the Task Prompts are based on Common Task Model and uses the Apache Velocity Template language - https://documentation.sas.com/doc/en/webeditorcdc/3.8/webeditordg/p11w43kg6zyc1tn10843n8bd0rrj.htm

 

 

sbxkoenk
SAS Super FREQ

Hello,

 

I know about Custom Tasks (*.ctk) and Common Task Model (*.ctm) in SAS Viya

, but my experience using / building these is very limited.

 

Custom tasks use different syntax while building inputs
, but at the end I think SAS will see macro variables, or list of macro variables like &var1-&var10.

And if user creates input in the XML syntax for which the name is "program" , I would guess that somewhere on the SAS session there should be some kind &program variable containing the value which was inserted by user. No?

 

I am not sure though ...
Probably @XavierBizoux can help you out.

 

BR, Koen

 
dylanviking
Calcite | Level 5

Hi Koen,

 

<Option defaultExtension="sas" defaultName="program" inputType="sasserverpath" pathtype="file" required="true" name="var_sasprog"/>

 

The sasserverpath input type returns an object. This input type provides an interface for the user to select the folder/SAS program via a user-friendly dialog box.

As mentioned in my original post, the value of the SAS program or folder is in the fullPath variable within the object. Unfortunately I do not know how to access that variable.

 

In other input types like a text box, the variables are straightforward and a Macro variable is generated and I can use these variables directly in my code. I've tried doing a %put _ALL_ to see if there are any variables that are populated but I can't see any. 

sbxkoenk
SAS Super FREQ

Hello,

 

I see ...

Thanks for explaining further.

 

Let's hope @XavierBizoux is available today or tomorrow to help you out.

Koen

XavierBizoux
SAS Super FREQ

Hi, 

 

I've to admit that I've never used the file selector. Based on my experience, not all the options available in the CTM are implemented in SAS Job Execution. This should be one of the options which is not handled. While the prompt will display properly, the value may not be passed to the job. The easiest to workaround this limitation, would be to use a dataset as source for the prompt. The dataset should be created upfront and contain all the SAS code a user can select to execute. 

Depending on your needs, you may want to convert your prompt to HTML and use the SAS Content SDK to navigate inside the content server. Using SAS Content SDK, you can display only the job type. 

Let me know if you have questions. 

 

 

Xavier BIZOUX
Advisory Technical Architect ● Global Enablement and Learning
Technology Transfer and Governance, R&D
dylanviking
Calcite | Level 5

Thanks Xavier. I guess we will have to manage without the file selector. Will probably go down the dataset but there are many limitations to this option. 

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 7 replies
  • 1784 views
  • 2 likes
  • 3 in conversation