Creating placeholder graphics in SAS using PROC GSLIDE for when no data are available
18th March 2012Recently, I found myself with a plot to produce, but there were no data to be presented, so a placeholder output was needed. For a listing or a table, this is a matter of detecting if there are observations to be listed or summarised and then issuing a placeholder listing using PROC REPORT if there are no data available. Using SAS/GRAPH, something similar can be achieved using one of its curiosities.
In the case of SAS/GRAPH, PROC GSLIDE
looks like the tool to user for the same purpose. The procedure does get covered as part of a SAS Institute SAS/GRAPH training course, but they tend to gloss over it. After all, there is little reason to go creating presentations in SAS when PowerPoint and its kind offer far more functionality. However, it would make an interesting tale to tell how GSLIDE
became part of SAS/GRAPH in the first place. Its existence makes me wonder if it pre-exists the main slideshow production tools that we use today.
The code that uses PROC GSLIDE
to create a placeholder graphic is as follows (detection of the number of observations in a SAS dataset is another entry on here):
proc gslide;
note height=10;
note j=center "No data are available";
run;
quit;
PROC GSLIDE
is one of those run group procedures in SAS so a QUIT statement is needed to close it. The NOTE statements specify the text to be added to the graphic. The first of these creates a blank line of the required height for placing the main text in the middle of the graphic. It is the second one that adds the centred text that tells users of the generated output what has happened.
Creating waterfall plots in SAS using PROC GCHART
17th March 2012Recently, I needed to create a waterfall plot couldn't use PROC SGPLOT
since it was incompatible with publishing macros that use PROC GREPLAY
on the platform that I was using; SGPLOT
doesn't generate plots in SAS catalogues but directly creates graphics files instead. Therefore, I decided that PROC GCHART
needed to be given a go, and it delivered what was needed.
The first step is to get the data into the required sort order:
proc sort data=temp;
by descending result;
run;
Then, it is time to add an ID variable for use in the plot's X-axis (or midpoint axis in PROC GCHART
) using an implied value retention to ensure that every record in the dataset had a unique identifier:
data temp;
set temp;
id+1;
run;
After that, axes have to be set up as needed. For instance, the X-axis (the axis2 statement below) needs to be just a line with no labels or tick marks on there and the Y-axis was fully set up with these, turning the label from vertical to horizontal as needed with the ANGLE option controlling the overall angle of the word(s) and the ROTATE
option dealing with the letters, and a range declaration using the ORDER
option.
axis1 label=none major=none minor=none value=none;
axis2 label=(rotate=0 angle=90 "Result") order=(-50 to 80 by 10);
With the axis statements declared, the GCHART
procedure can be defined. Of this, the VBAR
statement is the engine of the plot creation, with the ID variable used for the midpoint axis and the result variable used as the summary variable for the Y-axis. The DISCRETE
keyword is needed to produce a bar for every value of the ID variable, or GCHART
will bundle them by default. Next, references for the above axis statements (MAXIS option for midpoint axis and AXIS option for Y-axis) are added, and the plot definition is complete. One thing that has to be remembered is that GCHART
uses run group processing, so a QUIT
statement is needed at the end to close it at execution time. This feature has its uses and appears in other procedures too, though SAS procedures generally are concluded by a RUN
statement.
proc gchart data=temp;
vbar id / sumvar=result discrete axis=axis2 maxis=axis1;
run;
quit;
Do we need dongles anymore?
12th March 2012Recent exposure to both the HTC Wildfire S and the HTC Desire S has me wondering if we need mobile broadband dongles any more. The reason for my asking this is that both Android devices can act as mobile Wi-Fi hubs, and they work very well as these too. Even the dedicated T-Mobile mobile Wi-Fi hub that I picked up in the closing months of 2011 now looks a little obsolete, though it retains a cost advantage in its favour.
In the case of both HTC phones, it thankfully is possible to use high security encryption and a pass key too. However, it is best to change the default key before any activation of Wi-Fi signal, if only to ensure that you don't end up with a very nasty bill. The Wi-Fi Hotspot App has all the settings that you need and up to five connections can be supported at a time, just like that T-Mobile hub that I mentioned earlier.
That replaced a defunct dongle from the same company; the USB connection appeared to have failed and was ailing for a while. Now, it might be that the more transparent use of an actual mobile phone might be usurping that as well, especially when I have been wondering why it has been doing so well with internet connectivity while using it on the move. This voyage into the world of what smartphones and similar devices can do is throwing up its share of surprises as I go along.
Smoother use of more than one SAS DMS session at a time
11th March 2012Unless you have access to SAS Enterprise Guide, being able to work on one project at a time can be a little inconvenient. It is possible to open up more than one Display Manager System (DMS, the traditional SAS programming interface) session at a time only to get a pop-up window for SAS documentation for the second and subsequent sessions. You don't get your settings shared across them, either, while also losing any changes to session options after shutdown.
The cause of both of the above is the locking of the SASUSER directory files by the first SAS session. However, it is possible to set up a number of directories and set the -sasuser
option to point at different ones for different sessions.
On Windows, the command in the SAS shortcut becomes:
C:\Program Files\SAS\SAS 9.1\sas.exe -sasuser "c:\sasuser\session 1\"
On UNIX or Linux, it would look similar to this:
sas -sasuser "~/sasuser/session1/"
Since the "session1" in the folder paths above can be replaced with whatever you need, you can have as many as you want too. It might not seem much of a need but synchronising the SASUSER folders every now and again can give you a more consistent set of settings across each session, all without intrusive pop up boxes or extra messages in the log too.
Changing to web fonts
12th February 2012While you can add Windows fonts to Linux installations, I have found that their display can be flaky to say the least. Linux Mint and Ubuntu display them as sharp as I'd like, but I have struggled to get the same sort of results from Arch Linux, while I am not so sure about Fedora or openSUSE either.
This led me to explore web fonts for my websites, with Google Web Fonts meeting my needs through options like Open Sans and Arimo. There have been others with which I have dallied, such as Droid Sans, but these are the ones on which I have settled for now. Both are in use on this website now, and I added calls for them to the web page headers using the following code (lines are wrapping due to space constraints):
<link href="http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,400,300,600,700" rel="stylesheet" type="text/css">
<link href='http://fonts.googleapis.com/css?family=Arimo:400,400italic,700,700italic' rel='stylesheet' type='text/css'>
With those lines in place, it then is a matter of updating font-family and font declarations in CSS style sheets with "Open Sans" or "Arimo" as needed, while keeping alternatives defined in case the Google font service goes down for whatever reason. A look at a development release of the WordPress Twenty Twelve theme caused me to come across Open Sans and I like it for its clean lines and Arimo, which was found by looking through the growing Google Web Fonts catalogue, is not far behind. Looking through that catalogue now causes for me a round of indecision since there is so much choice. For that reason, I think it's better to be open to the recommendations of others.
Command line setting of Windows file attributes
11th February 2012Aside from permissions that can be set using the cacls
command, Windows files have properties like read only, archive and hidden. Of course, these are not the same or as robust as access permissions, but they may have a use in stopping accidental updates to files when you don't have access to use of the cacls
command. While you could set these attributes using the properties page of any file, executing the attrib
command on the Windows command is more convenient. Here are some possible usage options:
Set the read-only flag on a file:
attrib +r test.txt
Remove the read-only flag from a file (found a use for this one recently):
attrib -r test.txt
Set the archive flag on a file:
attrib +a test.txt
Remove the archive flag from a file:
attrib -a test.txt
Set the hidden only flag on a file:
attrib +h test.txt
Remove the hidden flag from a file:
attrib -h test.txt
Using the /s
option and wildcards processes a number of files at a time and /d
applies the command to directories. They could come in handy when removing read only attributes (also called bits in places) from files copied from read only optical media, such as CD's and DVD's.
A new phone
4th February 2012After a few years with a straightforward Nokia 1661 and a PAYG Blackberry 8520, I decided to go and upgrade from the former to an HTC Wildfire S. So far, the new phone has been good to me with only a few drawbacks. Other than working out how to insert a SIM card, the phone has been easy to use with just a few nuances to learn, such as finger pinch zooming and dealing with an onscreen keyboard as opposed to a real one.
The touchscreen and 3G connectivity are major upgrades from my Blackberry, making web browsing much faster, especially on the larger screen. Checking Google Reader and emails on the go is quicker, with the screen responding well most of the time. It does get dirty, so using a screen protector or regularly cleaning with a lens cloth is advisable. As it happens, I'm still adjusting to the onscreen keyboard, which remains the one area where the Blackberry remains superior. Rotating the phone sideways helps by enlarging the keys, reducing typing errors even for my average-sized fingers. Switching between alphabetic, numeric, and punctuation keyboards still takes some getting used to.
Otherwise, the user interface is bright and pleasing to the eye, with the typical presentation of both a clock and current weather on there. Handily, the screen is locked easily too with a press of the button at the top right of the phone. That will put a stop to inadvertent phone calls, emailing, web browsing and other things, so it is to be commended. To unlock the screen, all that's needed is to swipe the lock bar to the bottom. Any alerts are viewed similarly with holding down your finger on the top bar presenting an extension that can be pulled all the way down to see what's there.
The Android Marketplace icon on the home screen lets me easily add apps with automatic updates, though this requires monitoring data usage on your phone plan. The WordPress app works better than on my Blackberry, but UberSocial's retweeting function is worse on Android. It displays all account feeds on one screen and requires swiping for actions like replying or retweeting, which I find awkward. I might try an alternative app. I've downloaded several others, including CrossCountry Trains' app (which is good, despite failing to find Macclesfield-Edale Sunday trains) and LinkedIn (which works well). You can move apps to the microSD card to save internal storage space, though I don't plan to install many.
The Wildfire performs well at its core function: making and receiving calls. It imported contacts from my SIM card, though Bluetooth transfer from an old phone is also possible. Call sound quality is clear and loud. The side rocker button adjusts speaker volume during calls and ringtone volume otherwise. By default, the phone vibrates and rings simultaneously for incoming calls, which I may change later. The same applies to notification sounds for text messages, emails, and tweets.
Battery life is this phone's main weakness. It needs charging every night, unlike my previous phones. The bright, responsive screen likely causes this drain. Many users report similar issues online, with some experiencing even worse battery performance. While there are tips for extending battery life, they involve disabling key features like 3G or data connectivity, which defeats the purpose of having a smartphone. Thus, I'm considering buying a spare battery, as I did for my Pentax DSLR. Some users recommend higher-capacity replacement batteries, though this seems riskier.
All in all, first impressions of the HTC Wildfire are good ones. Over time, I should find out more about the ins and outs of the gadget. After all, it is a mini-computer with its own operating system and other software. Since I continue to learn more and more about PC's every day, the same should be the case here too.
Widely differing approaches
28th January 2012The computer on which I am writing these words is running Linux Mint with the Cinnamon desktop environment, a fork of GNOME Shell. This looks as if it will be the default face of GNOME 3 in the next version of Linux Mint, with the MGSE dressing up of GNOME Shell looking more and more like an interim measure until something more consistent was available. While some complained that what was delivered in version 12 of the distribution was a sort of greatest hits selection, I reckon that bets were being hedged by the project team.
Impressions of what's coming
By default, you get a single panel at the bottom of your screen with everything you need in there. However, it is possible to change the layout so that the panel is at the top or there are two panels, one at the top and the other at the bottom. So far, there is no means of configuring which panel applet goes where, as was the case in Linux Mint 11 and its predecessors. However, the default placements are very sensible, so I have no cause for complaint at this point.
Just because you cannot place applets doesn't mean that there is no configurability, though. Since Cinnamon is extensible, you can change the way that time is displayed in the clock, as well as enabling additional applets. It also is possible to control visual effects, such as the way new application windows pop up on a screen.
GNOME 3 is there underneath all of this, though there's no sign of the application dashboard of GNOME Shell. The continually expanding number of slots in the workspace launcher is one sign, as is the enabling of a hotspot at the top right hand corner by default. This brings up an overview screen showing what application windows are open in a workspace. The new Mint menu even gets the ability to search through installed applications, together with the ability to browse through what's available.
In summary, Cinnamon already looks good, though a little polish and extra configuration options wouldn't go amiss. An example of the former is the placement of desktop numbers in the workspace switcher, and I already have discussed the latter. It does appear that the Linux Mint approach to desktop environments is taking shape with a far more conventional feel than the likes of Unity or GNOME Shell. Just as Cinnamon has become available in openSUSE, I can see it gracing LMDE too whenever Debian gets to moving over to GNOME 3 as must be inevitable now unless they take another approach such as MATE.
In comparison with a revolution
While Linux Mint are choosing convention and streamlining GNOME to their own designs, it appears that Ubuntu's Unity is getting ever more experimental as the time when Ubuntu simply evolved from one release to the next becomes an increasingly more distant memory. The latest development is the announcement that application menus could get replaced by a heads-up display (HUD) instead. That would be yet another change made by what increasingly looks like a top-down leadership, reminiscent of what exists at Apple. While it is good to have innovation, you have to ask where users fit in all of this when Linux Mint already has gained from what has been done so far and may gain more again. Still, seeing what happens to Ubuntu sounds like an interesting pastime, though I'm not sure that I'd be depending on the default spin of this distro as my sole operating system right now. Also, changing the interface every few months wouldn't work in a corporate environment at all, so you have to wonder where Mark Shuttleworth is driving all this, though Microsoft is engaging in a bit of experimentation of its own. We are living in interesting times for the computer desktop, so it's just as well that there are safe havens like Linux Mint, too. Watching from afar sounds safer.
Dispensing with temptation
26th January 2012Many manufacturers followed Olympus into the compact system camera market. Nikon joined late last year, though Canon hasn't yet entered. Olympus E-PL1 kits with 14-42mm zoom lenses tempted me at around £250. After researching competitors, my shortlist included the Samsung NX-11, Sony NEX-C3, and its higher-end model, the NEX-5N.
What eventually countered the allure of shiny objects was the question as to why I needed such an item. After all, I already possess a Pentax K10D DSLR and a Canon PowerShot G11, and these have been satisfying my photographic needs for a while now. While the DSLR may date from 2007, it is still working well for me and, if it ever needed replacing, I'd be going for another Pentax with the K-5 being a strong contender. The Canon is doing what's asked of it, so the recent launching of the G1 X isn't so tempting either.
The whole dalliance has me wondering about how photographic equipment changeovers come about. After all, it was around a decade ago with the DSLR revolution was in the offing if not in progress. Until then, film photography was predominant, but it looks as if it got as far as it could from a technological point of view when I look back at what happened. The digital photography area was new and untapped, so moving there offered new possibilities and purchases more easily justified. The end result is that very few film cameras are being made nowadays. Ironically, it's film photography that now is untrammelled terrain for many, and it is holding its own too in an era when digital photography predominates.
The same sort of newness that came with digital photography also applies to CSC's to a certain extent. From the heritage of half-frame 35 mm film photography, Olympus has fashioned a different type of digital camera: essentially a compact with interchangeable lenses. Was it the fact that I have no CSC that caused me to be tempted and has it happened to others too? Also, is that what got digital photography going in the first place?
It almost feels as if camera manufacturers have to keep bringing to market new models and new types of camera to stay in business. After all, Minolta had to sell its camera division to Sony when they failed to get going in the DSLR market quickly enough. The same thing might have happened to Pentax too, with the marque passing to first to Hoya, and then to Ricoh after the firm lost its independence.
What doesn't help is the lack of longevity of camera models. The coming of digital photography has exacerbated this situation, with models being launched at a frenetic rate. In the days of film photography, a model could last on the market for a few years and there was once a time when a twenty-year lifetime wouldn't have looked so ridiculous, though there were incremental improvements made over that time too. For instance, a Pentax K1000 wouldn't be the same at the end of its production run as it was at the start, though the model number may be the same. That world is gone.
SLR design has endured for about 50 years, but mirrorless technology now presents unprecedented competition. Even compact cameras offer live through-the-lens viewing. Olympus revived its film heritage by creating the E-P1 with interchangeable lenses. These descendants of the original half-frame 35mm PEN cameras appropriately use smaller micro four thirds sensors. Sony has developed translucent mirror technology that eliminates moving parts found in traditional SLRs. Canon experimented with this in the 1980's with film cameras but abandoned it. Meanwhile, Samsung and Panasonic produce mirrorless SLR-style cameras with live viewing and electronic viewfinders, suggesting full-size equivalents may be coming. Olympus's current teaser campaign has sparked speculation about a possible OM-D release.
In parallel with all this, Sony is making a good impression with their CSC's, the NEX series. These have APS-C sized sensors like many DSLR's and in compact bodies as well. However, the feel very much is that of a compact camera and some have complained of a like of buttons on them, even if the photographic quality is excellent. Samsung have gone for the same sensor size in their NX-11, while they have gone for SLR styling. That may be more suitable for some than having to find settings buried in menus.
We're living in an exciting yet unsettling period of camera technology evolution. Cameras are becoming smaller, and traditional still cameras now shoot videos too, though filmmaking remains a time-intensive hobby that doesn't interest me. Recent legal developments complicate original work, as shown by a successful copyright case based on Photoshop image processing. With countless images being created daily and potential changes allowing intellectual property claims in small claims courts, avoiding infringement becomes harder. Film photography seems appealing in contrast and remains viable despite Kodak's financial struggles. As tastes shift and film becomes novel again, the future is uncertain. Perhaps investing in a DSLR body makes sense before Compact System Cameras completely replace them. Camera technology has become interesting once more.
A few thoughts on Ubuntu 12.04 Alpha 1
22nd January 2012After an aborted installation in VirtualBox using the direct installation, I got a VM instance of Ubuntu 12.04 in place by installing from a loaded Live CD session. That proceeded without any trouble and downloaded the required updates too. First impressions revealed a polished Unity interface that ran without any crashes. The task of adding VirtualBox's Guest Additions in the usual way was all that was needed to tart up the experience even more. However, there remains a wish list for improvements to the Unity desktop, so here are mine:
- Merging of an application title bar with the desktop's top panel on maximisation: In 11.10, removing the
appmenu
packages does force menus into application windows and that seems to be destined as a configurable item in Unity at some point; it'd be good to see it in 12.04 though it's not in the first alpha release. The merging of the panel and title bar would be a good thing to have as a user setting too because I am unconvinced by the current behaviour when there is plenty of screen space. - Rearranging icons on the application launcher: There appears to be no obvious way to do this at the moment and attempting to move them with a mouse only moves the launcher up and down. There is no doubt that this behaviour is a bonus for those working with small screens, but it is a nuisance unless there is another means for achieving the same end.
- Desktop environment switcher on the login screen: This seems to have disappeared for now. Hopefully, this is an oversight that will see correction in later stages of the development of Ubuntu 12.04. This is how I currently get Ubuntu 11.10 to boot into GNOME Shell, so its loss would be a step backwards. Then, a Gubuntu project would become truly necessary, though I have to say that Linux Mint makes such a viable alternative that I wonder how they would get going.
In summary, it does look as if the Unity interface is getting more and more polished. However, there are niggles that I have described above that, I think, need addressing, and I hope that many of them will be addressed in either 12.04 or 12.10. Though usability seems to be improving, I still am left with the impression that it has a way to go yet.