Solved

checking the length of text field less than or equal to the assigned macro  - SAS

Posted on 2014-01-27
1
428 Views
Last Modified: 2016-02-10
I am building a text field based on variables coming in from a list.
I have created the macro below

Data _null_;
call symput("format_textrecord", '$10000.');  /*Setup variable for textrecord length */
run;

Once the textrecord is built through processing, I would like to check the length of the textrecord field to ensure that it is less than 10000.

Is there a way to do this using the macro variable.  I know this can be done by hardcoding 10000 in an if statement, but I want to avoid as much manual interaction as possible so that the check and the format stay iin sync.
0
Comment
Question by:morinia
1 Comment
 
LVL 14

Accepted Solution

by:
Aloysius Low earned 500 total points
ID: 39811981
I'm not understanding what you wish to check against what so taking a stab here

You can store the max length permissible in a macro variable, then use sashelp.vcolumn do a query to check length the field (can't recall field name but probably is LENGTH) by filtering by LIBNAME = library where table is stored AND MEMNAME = table name AND NAME = column name
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SAS Variable resolution on DB2 pass-thru PROC SQL 4 619
Assigning a macro variable within a macro in SAS 8 433
How to create empty file in SAS? 3 368
START option in SAS 3 71
The business world is becoming increasingly integrated with tech. It’s not just for a select few anymore — but what about if you have a small business? It may be easier than you think to integrate technology into your small business, and it’s likely…
Starting your own business is always a daunting process, and for most people it is brand new experience. Avoid the common pitfalls by following these tips to start on the road to success.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question