Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

PROC FREQ

Posted on 2011-04-29
2
Medium Priority
?
836 Views
Last Modified: 2013-11-16
Hi,  Does anyone know if I can run a proc freq on part of a string, like the first 3 characters?  
0
Comment
Question by:Wonderwall
2 Comments
 
LVL 9

Accepted Solution

by:
bradanelson earned 2000 total points
ID: 35494475
You can't use PROC FREQ unless you add a field prior to running the PROC FREQ containing the first three chars.  Ex:
DATA YourDataset;
SET YourDataset;
LENGTH First3 $3.; First3=SUBSTR(FieldYourWantToFREQOn,1,3);
RUN;

PROC FREQ DATA=YourDataset;
TABLE First3 /MISSING;
RUN;


OR if you want to do this without creating a new field, you might be able to get it done using PROC SQL.  Ex.
PROC SQL;
SELECT SUBSTR(FieldYourWantToFREQOn,1,3) AS First3, COUNT(*) AS Obs
FROM YourDataset
GROUP BY First3;
QUIT;
0
 

Author Comment

by:Wonderwall
ID: 35494826
Thank you, That worked like a charm!!!!!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Among the most obnoxious of Exchange errors is error 1216 – Attached Database Mismatch error of the Jet Database Engine. When faced with this error, users may have to suffer from mailbox inaccessibility and in worst situations, permanent data loss.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

564 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