BookmarkSubscribeRSS Feed
merahilyana
Fluorite | Level 6

i need help??

 

example my value is:

state

kula lumpur

puterajaya

labuan

 

but i want it will be like this:

state

  kula lumpur

      puterajaya

  labuan

8 REPLIES 8
PeterClemmensen
Tourmaline | Level 20

What is the logic here?

merahilyana
Fluorite | Level 6
i want put space before kula lumpur n more space before puterajaya..that all
PeterClemmensen
Tourmaline | Level 20

Why? You just want to put for example two spaces before kula lumpur and four spaces before puterajaya.

merahilyana
Fluorite | Level 6

THAT IS EXAMPLE THE REAL DATA LIKE THIS:
BATU PAHAT
  M.P. Batu Pahat
    Bandar Penggaram

to show result at word like that..

Kurt_Bremser
Super User

What do you mean by "real data"? SAS datasets or external files from which SAS data needs to be created?

Also keep in mind that in many cases, SAS will not display leading blanks per default.

merahilyana
Fluorite | Level 6
MY DATA..NOT FROM SAS..JUST WANT APPEAR RESULT WILL BE LIKE THAT ONLY..
Astounding
PROC Star

If that data is already in a SAS data set, you need to take two steps.

 

First, add leading blanks.  For example:

 

varname = '  ' || varname;

 

Secondly, you need to preserve the leading blanks when displaying the variable.  For example:

 

format varname $char20.;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 8 replies
  • 1123 views
  • 2 likes
  • 4 in conversation