Bob Hull - PowerPoint PPT Presentation

About This Presentation
Title:

Bob Hull

Description:

Useful Tips for Handling and Creating Special Characters in SAS Bob Hull SynteractHCR, Inc. Carlsbad, CA Robert Howard Veridical Solutions San Diego, CA – PowerPoint PPT presentation

Number of Views:81
Avg rating:3.0/5.0
Slides: 13
Provided by: Verid1
Category:
Tags: bob | hull

less

Transcript and Presenter's Notes

Title: Bob Hull


1
Useful Tips for Handling and Creating Special
Characters in SAS
  • Bob Hull
  • SynteractHCR, Inc.
  • Carlsbad, CA

Robert Howard Veridical Solutions San Diego, CA
2
Presentation Outline
  • Reading in Special Characters
  • Unicode Data Error When Reading in SAS datasets
  • Reading in data from Excel
  • Writing out Special Characters
  • Within SAS and SAS outputs
  • Within RTF output

3
Unicode Data Error When Reading in SAS datasets
data temp set db.labs run
ERROR Some character data was lost during
transcoding in the dataset DB.LABS. Either the
data contains characters that are not
representable in the new encoding or truncation
occurred during transcoding.
Issue The data has Unicode characters in it and
your SAS session is not set up for Unicode even
though it appears the same as other SAS datasets.
4
Unicode Data Error When Reading in SAS datasets
data temp set db.labs (encoding'asciiany') ru
n
Solution
We can access a list of available SAS byte values
by using the BYTE function
data _null_ do k1 to 255 xbyte(k)
put k x end run
5
Unicode Data Error When Reading in SAS datasets
?
data temp set db.labs (encoding'asciiany')
unittranwrd(unit,byte(206),' ')
unittranwrd(unit,byte(188),byte(181)) run
6
Reading in data from Excel
A character return has been replaced with a ? We
can look up the SAS byte values
do aa1 to 29, 31, 127, 129, 141 to 144, 157,
158 var1tranwrd(var1,byte(aa),' ') end
7
Writing out Special Characters within SAS
Again, we look at the Unicode values and their
corresponding SAS byte value
data _null_ do k1 to 255 xbyte(k)
put k x end run
Example
data unit unitbyte(181)"mol/L" run
8
Writing out Special Characters within RTF
First, for RTF, we declare the ODS escapechar
ods escapechar""
We now have a wide range of special formatting
tools to modify our output
  • Bold title "Sfont_weightboldRTF Syntax
    S"
  • Italic variable"Sfont_styleitalicemphasis
    S"
  • Color variable"SforegroundredRed!S"
  • Superscript footnote1 "super 1p-value is
    from"
  • Special characters ? and many more

9
Writing out Special Characters within RTF
There are Unicode values for countless special
characters
define weight /display "unicode 2265 Weight"
10
Writing out Special Characters within RTF
11
Recommended Reading
For more information on Unicode in SAS, visit
http//support.sas.com/resources/papers/unicode913
.pdf For a complete list of Unicode Codes and
their corresponding special characters,
visit http//en.wikipedia.org/wiki/List_of_Unicod
e_characters
12
Thank you for your time and interest!
Rob Howard Veridical Solutions P.O. Box 656 Del
Mar, CA 92014 rob.howard_at_veridicalsolutions.com ww
w.veridicalsolutions.com
Bob Hull SynteractHCR, Inc. 5759 Fleet St, Suite
100 Carlsbad, CA 92008 rhull_at_synteract.com www.syn
teractHCR.com
Write a Comment
User Comments (0)
About PowerShow.com