BookmarkSubscribeRSS Feed
klmd189
Calcite | Level 5

Dear all,

I wonder if a possibility exists to limit possible values in desired column after producing Excel file using proc report.

I would like to code this option in SAS instead of setting this option in Excel by Data>Data Tools>Data Validation>Allow>List of values.

I just want to have one column with possible values limited to Y/N. Input data has this column empty but when it comes to editing this worksheet I want only Y/N values to be there.

 

2 REPLIES 2
ballardw
Super User

An appropriate format used for the values in Proc Report should work. But without data and report code it is hard to tell exactly what might be needed.

 

I am a bit unclear on how you expect "Input data has this column empty " to assign Y and N to specific cells though.

 

If you can provide an example of the data used for proc report in the form of a data step so that we can recreate data and test code, indicate which values need to appear as Y/N, plus your proc report code we can provide a more targeted response. Post the data step code and the report code into a code box on the forum using the {I} or "running man" icon.

klmd189
Calcite | Level 5

Thank your for your response. The text you quoted indicates that input file will have the column with missing value for all observations and the task is to make excel file from the input data so it is editable in MS Office tools. When someone wants to put a value into this column with empty values then I want him to have the possibility only to put "Y" or "N" value.

In code below I name this variable as yn.

This is an example of input data.

data test;
attrib subject label="Enrolment Code" length = $5
       yn label="Yes or no" length = $1
       ;
subject = "E1234";
yn = "";
output;
subject = "E1235";
yn = "";
output;
run;

Below I attach the desired output with data validation function.

 

forawhile.jpg

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 547 views
  • 1 like
  • 2 in conversation