BookmarkSubscribeRSS Feed
KevinViel
Pyrite | Level 9

In many examples, the object-reference (name) of the Java Object (javaobj) is one letter, often "j", "f", or "m". For example:

 

SAS® 9.4 Component Objects: Reference, Third Edition

Pg 78

 

/* DATA step code */

data _null_;

  dcl javaobj j("ttest");

  length val 8;

  length str $20;

  j.setIntField("i", 100);

  j.setDoubleField("d", 3.14159);

  j.setStringField("s", "abc");

  j.callIntMethod("im", val);

  put val=;

  j.callDoubleMethod("dm", val);

  put val=;

  j.callStringMethod("sm", str);

  put str=;

run;

 

 

Is this just convenience or is it meaningful?  I would tend to name it as informatively as possible, potentially with something like "__jo_" so that I can read my programs/logs with a program and find which used them.

 

However, if there is a reason, then less typing is always good 🙂

 

Thank you,

 

Kevin

1 REPLY 1
ybolduc
Quartz | Level 8

Personnally, I suspect it is just to save a bunch of keystrokes. Same reason I often use i, j and k as iterators when their "meaning" is very obvious.

 

Also, short variable names have the benefit of considerably reducing the risks of typos...

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!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 584 views
  • 0 likes
  • 2 in conversation