Make your SAS programs ready for any language

Slides:



Advertisements
Similar presentations
Introduction to PHP MIS 3501, Fall 2014 Jeremy Shafer
Advertisements

 2000 Deitel & Associates, Inc. All rights reserved. Chapter 17 - The Preprocessor Outline 17.1Introduction 17.2The #include Preprocessor Directive 17.3The.
Data types and variables
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 13 - The Preprocessor Outline 13.1Introduction.
Chapter 2 Data Types, Declarations, and Displays
 2000 Prentice Hall, Inc. All rights reserved. Chapter 13 - The Preprocessor Outline 13.1Introduction 13.2The #include Preprocessor Directive 13.3The.
1 Lab Session-III CSIT-120 Spring 2001 Revising Previous session Data input and output While loop Exercise Limits and Bounds GOTO SLIDE 13 Lab session.
Access 2007 ® Use Databases How can Microsoft Access 2007 help you manage a database?
Homework Reading –Finish K&R Chapter 1 (if not done yet) –Start K&R Chapter 2 for next time. Programming Assignments –DON’T USE and string library functions,
San José, CA – September, 2004 Localizing with XLIFF and ICU Markus Scherer Raghuram (Ram) Viswanadha IBM San.
© The McGraw-Hill Companies, 2006 Chapter 1 The first step.
Objectives You should be able to describe: Data Types
Homework Reading Programming Assignments
1 Chapter 2 Primitive Data Types and Operations F Introduce Programming with an Example  The MyInput class F Identifiers, Variables, and Constants F Primitive.
CHAPTER:14 Simple Queries in SQL Prepared By Prepared By : VINAY ALEXANDER ( विनय अलेक्सजेंड़र ) PGT(CS),KV JHAGRAKHAND.
© Copyright 1992–2005 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Tutorial 5 – Dental Payment Application: Introducing.
Hans-Peter Plag November 6, 2014 Session 4 (Programming Languages) (Data Types and Variables) Expressions and Operators Flow Control.
Introduction to SAS Macros Center for Statistical Consulting Short Course April 15, 2004.
Internationalization in ASP.NET 2.0. SQL Server 2005 – Data Columns Use Unicode datatypes in: Table columns, CONVERT() and CAST() operations Use Unicode.
 2003 Prentice Hall, Inc. All rights reserved. 1 IS 0020 Program Design and Software Tools Preprocessing Lecture 12 April 7, 2005.
 2003 Prentice Hall, Inc. All rights reserved. 1 IS 0020 Program Design and Software Tools Preprocessor Midterm Review Lecture 7 Feb 17, 2004.
Agenda Positional Parameters / Continued... Command Substitution Bourne Shell / Bash Shell / Korn Shell Mathematical Expressions Bourne Shell / Bash Shell.
 2000 Prentice Hall, Inc. All rights reserved. Chapter 13 - The Preprocessor Outline 13.1Introduction 13.2The #include Preprocessor Directive 13.3The.
Characters and Strings
Text TCS INTERNAL Oracle PL/SQL – Introduction. TCS INTERNAL PL SQL Introduction PLSQL means Procedural Language extension of SQL. PLSQL is a database.
Introduction to Javascript. What is javascript?  The most popular web scripting language in the world  Used to produce rich thin client web applications.
Random Logic l Forum.NET l Localization & Globalization Forum.NET ● May 29, 2006.
SAS ® 101 Based on Learning SAS by Example: A Programmer’s Guide Chapters 3 & 4 By Tasha Chapman, Oregon Health Authority.
13 C Preprocessor.
Bill Tucker Austin Community College COSC 1315
C++ First Steps.
Development Environment
Chapter 2 Variables.
Perl Regular Expression in SAS
Using ODS Excel Migrating from DDE to ODS
OASUS Spring or Fall YYYY
Chapter 13 - The Preprocessor
JSL File manager Brady Brady and Don Mccormack, JMP.
Design & Technology Grade 7 Python
Chapter 2: Getting Data into SAS
Variables, Expressions, and IO
Exam 3 Review.
Introduction to Scripting
Two “identical” programs
CSE 303 Concepts and Tools for Software Development
Agenda Warmup Lesson 2.5 (Ascii, Method Overloading)
Intro to PHP & Variables
Chapter 2 part #3 C++ Input / Output
PRG 421 GUIDE Lessons in Excellence -- prg421guide.com.
Chapter 1: Introduction to SAS
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
OASUS Spring or Fall YYYY Lihsin Hwang Statistics Canada
Tamara Arenovich Tony Panzarella
Fall 2017 Questions and Answers (Q&A)
Introduction to CS Your First C Programs
C Preprocessor(CPP).
Chapter 2 Variables.
Creating your first C program
elementary programming
Never Cut and Paste Again
You deserve ARRAYs! How to be more efficient using SAS®
Homework Reading Programming Assignments Finish K&R Chapter 1
Passing Simple and Complex Parameters In and Out of Macros
Chapter 2 part #3 C++ Input / Output
Unit 3: Variables in Java
Chapter 2 Variables.
Chapter 2 Primitive Data Types and Operations
EECE.2160 ECE Application Programming
CS313T Advanced Programming language
Getting Started With Coding
Presentation transcript:

Make your SAS programs ready for any language Lihsin Hwang Statistics Canada

OASUS Spring or Fall YYYY Friday, November 16, 2018 Agenda Concept and options Locale String Externalization Steps Demo First & last name Company name

OASUS Spring or Fall YYYY Friday, November 16, 2018 Concept and Options Concept Allow your application to speak multiple languages without changing the code Minimize the workload required to apply a new language Options Keep multiple SAS programs Multiple %put statements Format String Externalization First & last name Company name

OASUS Spring or Fall YYYY Friday, November 16, 2018 Locale Conventions for handling written language and various units Display of numbers, dates, currency..etc Identifies a specific user preference and represents a language in a geographical region First & last name Company name

OASUS Spring or Fall YYYY Friday, November 16, 2018 Set Locale sasv9.cfg -LOCALE “EN_GB” SAS system options Options locale=French_Canada; Options locale=en_US; setlocale(sas_locale) So how do we set and retrieve locale? Set: SAS support long name (SAS name) and short names (POSIX name) First & last name Company name

OASUS Spring or Fall YYYY Friday, November 16, 2018 Retrieve Locale getOption %LET PLOC=%SYSFUNC(getOption(LOCALE)); %PUT &PLOC ; ENGLISH_UNITEDSTATES getpxLocale: five-letter POSIX locale value (en_us) getpxLanguage: two-letter language (en) getpxRegion: two-letter region code (US) First & last name Company name

String Externalization Process OASUS Spring or Fall YYYY Friday, November 16, 2018 String Externalization Process Identify and move translatable strings Create .smd file Convert .smd files Create the final SAS data set Retrieve the messages in your application First & last name Company name

OASUS Spring or Fall YYYY Friday, November 16, 2018 Process Step I Step 1: Identify and move translatable strings Excel file contains each language on a separate column First & last name Company name

OASUS Spring or Fall YYYY Friday, November 16, 2018 Process Step II Step 2: Create.smd file proc import, excel engine via PCFile Server… etc put together keys and values each localized .smd file, shared the same base name message.smd message_es_mx.smd message_fr.smd First & last name Company name

OASUS Spring or Fall YYYY Friday, November 16, 2018 Process Step III Step 3:Convert SMD files All characters that cannot be expressed as ASCII must be represented with UNICODE escape sequence Tools to use: KPROPDATA function (SAS) UNICODEC function (SAS) First & last name Company name

OASUS Spring or Fall YYYY Friday, November 16, 2018 Process Step IV Step 4: Create the final SAS data set Such data sets can be created with the %SMD2DS() macro function. The macro %SMD2DS is available in the SAS AUTOCALL library: %SMD2DS(DIR=,BASENAME=,LOCALE=,LIB=) %smd2ds ( dir = &base_dir, basename = message, locale = &locale_list lib = ); Contain four variables : path shared base name english french # Variables Name Type Length DESC 1 Locale char 5 Language of the message 2 Key 60 Key to identify the message 3 Lineno num line # of the message in reverse order 4 Text 1200 Text of the message First & last name Company name

Output Final output – SAS Data set 16/11/2018

OASUS Spring or Fall YYYY Friday, November 16, 2018 Process Step V Retrieve the messages in your application %SYSFUNC(SASMSG(BASENAME, KEY, <<QUOTE|Q|DQUOTE|D|NOQUOTE|N> <, substitute1, substitute2, ...>>) SASMSG("BASENAME", "KEY", <<"QUOTE"|"Q"|"DQUOTE"|"D"|"NOQUOTE"|"N"> <, "subs1", "subs2", ...>>) %PUT %SYSFUNC(SASMSG(&msgDataset, 00-1, D, &user, &adate)) ; %PUT %SYSFUNC(SASMSG(&msgDataset, 00-2, N)); %PUT %SYSFUNC(SASMSG(&msgDataset, 00-3, N, UnitID)); data _null_; msg = sasmsg("&msgDataset",“00-1","noquote" , "&user", "&adate"); put msg; run; First & last name Company name

Now your child is trilingual! OASUS Spring or Fall YYYY Friday, November 16, 2018 Now your child is trilingual! Locale set to EN_CA "Hello Steve! Today's date is May 26." ERROR: Weight variable cannot have any other role assigned to it in the same table ERROR: UnitID variable must have at least one group Locale set to FR_CA "Bonjour Steve! Aujourd'hui nous sommes le 26 mai 2015." ERROR: Variable pondérée ne peut pas avoir d'autre rôle lui est attribué par la même table ERROR: UnitID variable doit avoir au moins un groupe Locale set to ES_MX "Hello Steve! Today's date is 26 de mayo de 2015." ERROR: Variable de peso no puede tener ninguna otra función asignada en la misma tabla ERROR: Variable de UnitID debe tener al menos un grupo First & last name Company name

String Externalization Pros and Cons OASUS Spring or Fall YYYY Friday, November 16, 2018 String Externalization Pros and Cons Pros Minimum code maintenance Fallback mechanism Cons Setup itself cannot use the dataset First & last name Company name

OASUS Spring or Fall YYYY Friday, November 16, 2018 Resources Write Once, Run Anywhere! How to Make Your SAS Applications Speak Many Languages, Mickaël Bouedo, SGF paper 254-2012. SAS 9.3 National Language Support (NLS): Reference Guide. First & last name Company name

OASUS Spring or Fall YYYY Friday, November 16, 2018 Demo Time First & last name Company name

OASUS Spring or Fall YYYY Questions / Comments Friday, November 16, 2018 Lihsin Hwang System Engineering Division Statistics Canada (613) 799-6952 Lihsin.Hwang@statcan.gc.ca First & last name Company name