SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Patrick
Opal | Level 21

Hi all,

 

Using SAS EG while populating and then printing a control table with some test data I've encountered a case where the data messes-up the output (sample below).

Do you know of any way to avoid such a result without having to encode characters in the source data so they become "html safe"?

data work.sample;
  infile datalines4 truncover dlm='|' dsd;
  input
    rule_type :$30.
    rule_desc :$100.
    ;
  datalines4;
Not Null|Raise issue if value is missing
In a List|Raise issue if value NOT found in a list
Not In a List|Raise issue if value found in a list
In Value Range|Raise issue if value NOT within boundaries
Not In Value Range|Raise issue if value within boundaries
Lookup Exist|<table for hash> <keyvar(s) hash> <keyvar(s) table if different names>
Not Lookup Exist|<table for hash> <keyvar(s) hash> <keyvar(s) table if different names>
Unique Key|<space separated list of variables that make up the unique key>
Custom Function|Any SAS expression that return True or False. Example: <var 1> = <var 2>
;;;;

proc print data=work.sample;
run;

Patrick_0-1674287115095.png

Thanks,

Patrick

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User

Patrick,

Try this one.

 

data work.sample;
  infile datalines4 truncover dlm='|' dsd;
  input
    rule_type :$30.
    rule_desc :$100.
    ;
  datalines4;
Not Null|Raise issue if value is missing
In a List|Raise issue if value NOT found in a list
Not In a List|Raise issue if value found in a list
In Value Range|Raise issue if value NOT within boundaries
Not In Value Range|Raise issue if value within boundaries
Lookup Exist|<table for hash> <keyvar(s) hash> <keyvar(s) table if different names>
Not Lookup Exist|<table for hash> <keyvar(s) hash> <keyvar(s) table if different names>
Unique Key|<space separated list of variables that make up the unique key>
Custom Function|Any SAS expression that return True or False. Example: <var 1> = <var 2>
;;;;

proc report data=work.sample nowd style(column)={PROTECTSPECIALCHARS=yes};
run;

Ksharp_0-1674312062715.png

 

View solution in original post

1 REPLY 1
Ksharp
Super User

Patrick,

Try this one.

 

data work.sample;
  infile datalines4 truncover dlm='|' dsd;
  input
    rule_type :$30.
    rule_desc :$100.
    ;
  datalines4;
Not Null|Raise issue if value is missing
In a List|Raise issue if value NOT found in a list
Not In a List|Raise issue if value found in a list
In Value Range|Raise issue if value NOT within boundaries
Not In Value Range|Raise issue if value within boundaries
Lookup Exist|<table for hash> <keyvar(s) hash> <keyvar(s) table if different names>
Not Lookup Exist|<table for hash> <keyvar(s) hash> <keyvar(s) table if different names>
Unique Key|<space separated list of variables that make up the unique key>
Custom Function|Any SAS expression that return True or False. Example: <var 1> = <var 2>
;;;;

proc report data=work.sample nowd style(column)={PROTECTSPECIALCHARS=yes};
run;

Ksharp_0-1674312062715.png

 

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 1 reply
  • 578 views
  • 1 like
  • 2 in conversation