LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (May 2002, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 15 May 2002 12:18:13 -0400
Reply-To:     Randy Herbison <RandyHerbison@WESTAT.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Randy Herbison <RandyHerbison@WESTAT.COM>
Subject:      Re: List box control problem
Comments: To: Bill Vsterlund <billiboj@HOTMAIL.COM>
Content-Type: text/plain; charset="iso-8859-1"


When I execute your code, on a Pentium PC with 128MB of RAM and running Windows 98 and SAS 8.2, the listbox control displays 2000 values correctly. But if I try 3000 values, I encounter the same type of problem you reported.

You may want to try a simpler, less resource intensive way to display the values. Rather than using code to populate the values listbox control, use the variable list and variable values list models. You can eliminate most, if not all, of the code by using attribute linking:

1. Link the variable values list model's dataset attribute to the variable list model's dataset attribute. 2. Link the variable values list model's variable attribute to the selectedItem attribute for the listbox control that displays the variable names. 3.Set the variable values list model's sortOrder attribute.

This doesn't retrieve the selected variable's label, left justify numeric values, or exclude missing values for character variables, but it does allow you to display more values. Using this method, I was able to display 3000 values correctly.

-----Original Message----- From: Bill Vsterlund [mailto:billiboj@HOTMAIL.COM] Sent: Wednesday, May 15, 2002 4:06 AM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: List box control problem

> > Posted via Mailgate.ORG Server - http://www.Mailgate.ORG > > What SAS version, host platform and memory ? > How do you populate the list ? LVARLEVEL ? > Is the variable numeric or character (guessing numeric) ? > > LVARLEVEL should collapse all missing values to a single item. > Do you have options active that multiple types of missing values ? > If the data _is_ character, there could be many variations of unprintable > strings in your data causing the 3 or 4 'blank' lines. > > This is some host resource based upper limit for the number of items, for > instance, 50,000 items locks up my SAS session pretty good, and 5,000 is > barely fast enough to meet my standard of fast enough. The time > consumption comes from the listbox1.items assignment. > > Try this snippet. Do 1,000 items show up in your list box ? > > init: > items = makelist(); > > do i = 1 to 1000; > rc = insertc (items, put(i,best8.)); > end; > > listbox1.items=items; > > rc = dellist (items); > return; > > or this snippet > > init: > dsid = open ('myData', 'NEW'); > rc = newvar (dsid, 'myVariable', 'N'); > rc = close (dsid); > > dsid = open ('myData', 'U'); > call set (dsid); > do i = 1 to 1000; > myVariable = (i-500) / 314 ; > rc = append (dsid); > end; > rc = close (dsid); > > items = makelist (); > dsid = open ('myData'); > nlevels = 0; > rc = lvarlevel (dsid, 'myVariable', nlevels, items); > rc = close (dsid); > > listbox1.items = items; > > rc = dellist (items); > return; > > -- > Richard A. DeVenezia > SAS/AF example - Maintaining Aspect >

I use a windows 2000 machine and SAS 8.2.

Yes, I use LVARLEVEL to populate a list that is used to create another list to fill the list box with where the variable is numeric. The list looks alright when I look at it using Call putlist, so I don't think there is anything wrong with the list. LVARLEVEL seems to work. But in the listbox the first observations get blank, and the dataset have no missing values in that variable. They first observations should have the values -0.22 -0.15 -0.08. Which they have in the list and which is shown using call putlist. Now the first value is -0.07. The values are not strange in any way. And sometimes a vertical bar is shown instead of the one of the mentioned values. Very strange.

I tried your first snippet and that did work, even when I used a list with numeric values.

This is the code: CLASS: *Class is a listbox holding all variables. The variable that is selected is the one which vaules are displayed in the listbox named VALUE;

valuelst=makelist(); dsid = open(dataset);

row = class.selectedIndex ; issel = class.selectedIndex ;

if issel then do; nl = 0; varname = nameitem(classlst,row); varlabel= varlabel(dsid,varnum(dsid,varname)); rc = lvarlevel(dsid,varname,nl,valuelst);

* left justify values / clean out blanks / reverse the list; templist = makelist(); do x = 1 to listlen(valuelst); value = getitemc(valuelst,x); if value ne '' then do; if vartype(dsid,varnum(dsid,varname)) = 'C' then rc = insertc(templist,left(value),1); else do; arg8 = left(value); rc = insertn(templist,inputn(arg8,'best.'),1); end; end; end; rc = sortlist(templist); valuelst = copylist(templist); valuelst=sortlist(valuelst);

templist = dellist(templist);

* refresh; values.items = valuelst ; values._cursor() ; call putlist(valuelst); end; if dsid then dsid = close(dsid); return;

-- Posted via Mailgate.ORG Server - http://www.Mailgate.ORG

Back to: Top of message | Previous page | Main SAS-L page